Old 08-05-2019, 06:57 AM   #1
Travesty
Human being with feelings
 
Travesty's Avatar
 
Join Date: Nov 2014
Posts: 498
Default Rescan database in media explorer

Is there any way to force a rescan of a database in media explorer?

I'd like to refresh the database automatically after a file has been rendered to it, or after a version control update.
Travesty is offline   Reply With Quote
Old 08-05-2019, 09:13 AM   #2
foxAsteria
Human being with feelings
 
foxAsteria's Avatar
 
Join Date: Dec 2009
Location: Oblivion
Posts: 6,849
Default

Right click the database. Don't know of a way to make it automatic tho.
__________________
Myy Wyyrd Muzyyk
foxAsteria is offline   Reply With Quote
Old 08-05-2019, 09:34 AM   #3
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,490
Default

@Travesty
Post that into my Ultraschall-API and I'll have a look at it.
Maybe I can do something about it..
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 08-05-2019, 10:42 AM   #4
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,972
Default

My databases related scripts just close and reopen the media explorer. Works nicely.
X-Raym is offline   Reply With Quote
Old 08-06-2019, 07:36 AM   #5
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,490
Default

Do you mean by database refreshing the file-listview?
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 08-06-2019, 07:45 AM   #6
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,972
Default

Oops I read too quickly,


What I meant is that refreshing a database file which have been altered can be done by closing and reopening media explorer,


but for the OP, who whant the file to be added to that database,
this means have a previous step: a script capable of adding a file to a database.


I have the code needed to do such things (database parser, file analysis etc) but I reserved to custom dev (it is not in free scripts).


Though, ricghtclick databse -> Rescan for new files is pretty fast so unless the database is really huge it may not worth it.
X-Raym is offline   Reply With Quote
Old 08-06-2019, 07:48 AM   #7
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,490
Default

Does this solve the issue? Needs Ultraschall-API to be installed:

Code:
function ultraschall.GetMediaExplorerHWND()
  local translation=reaper.JS_Localize("Media Explorer", "common")
  local auto_play=reaper.JS_Localize("Auto play", "explorer_DLG_101")
  local vol=reaper.JS_Localize("vol", "explorer_DLG_101")
  local navigate_backwards=reaper.JS_Localize("Navigate backwards", "access")

  local count_hwnds, hwnd_array, hwnd_adresses = ultraschall.Windows_Find(translation, true)
  if count_hwnds==0 then return nil
  else
    for i=count_hwnds, 1, -1 do
      if ultraschall.HasHWNDChildWindowNames(hwnd_array[i], 
                                            auto_play.."\0"..
                                            vol.."\0"..
                                            navigate_backwards)==true then return hwnd_array[i] end
    end
  end
  return nil
end 

function ultraschall.UpdateMediaExplorer()
  local HWND=ultraschall.GetMediaExplorerHWND()
  if ultraschall.IsValidHWND(HWND)==false then ultraschall.AddErrorMessage("UpdateMediaExplorer", "", "Can't get MediaExplorer-HWND. Is it opened?", -1) return false end
  return reaper.JS_Window_OnCommand(HWND, 40018)
end
Just run ultraschall.UpdateMediaExplorer() and it shows recently updated files in the Media Explorer.
Uses the refresh-action in MediaExplorer-section.
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 08-06-2019, 10:11 AM   #8
Travesty
Human being with feelings
 
Travesty's Avatar
 
Join Date: Nov 2014
Posts: 498
Default

I'll give that a go, thanks
Travesty is offline   Reply With Quote
Old 09-11-2019, 08:42 AM   #9
Travesty
Human being with feelings
 
Travesty's Avatar
 
Join Date: Nov 2014
Posts: 498
Default

This script refreshes the media explorer. I would like to initiate a rescan of a particular database on startup.
Travesty is offline   Reply With Quote
Old 09-11-2019, 12:44 PM   #10
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,490
Default

How do you trigger the update by mouse currently?
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:29 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.