maikeru1986 Posted December 16, 2020 Share Posted December 16, 2020 (edited) Simple plugin to automate the scraping/downloading of video snaps. Any comments to provide insight/improvement to the code etc. would be much appreciated. maikeru86 Edited January 6, 2021 by maikeru1986 linked to download section as I essentially had the same post in both places 1 Quote Link to comment Share on other sites More sharing options...
neil9000 Posted December 16, 2020 Share Posted December 16, 2020 You will probably get more eyes on this if you upload it to the appropriate section of the downloads part of the forums. Third-party Apps and Plugins - LaunchBox Community Forums (launchbox-app.com) I have to say though that it doesnt appear to be working for me. Im trying with Cyberpunk 2077, which does have a video link in the metadata which is to the 2018 E3 trailer at 1:40 long, however the plugin returns this. Quote Link to comment Share on other sites More sharing options...
maikeru1986 Posted December 16, 2020 Author Share Posted December 16, 2020 O ok, I'll post it there. i do feel it is not release worthy and is probably better to be tested first, like your issue with Cyberpunk2077. Mine does work however, same trailer at 1:40, but i'll look into it. Quote Link to comment Share on other sites More sharing options...
neil9000 Posted December 16, 2020 Share Posted December 16, 2020 1 minute ago, maikeru1986 said: i do feel it is not release worthy and is probably better to be tested first, like your issue with Cyberpunk2077. Yeah thats fair. Maybe you can get a few people testing here and see what the results are, as obviously im a test group of one, and it could totally be me being a dumbass or something unique to my system. Quote Link to comment Share on other sites More sharing options...
maikeru1986 Posted December 16, 2020 Author Share Posted December 16, 2020 (edited) 1 hour ago, neil9000 said: as obviously im a test group of one, and it could totally be me being a dumbass or something unique to my system. Well, even if it's unique to your system it's still valuable input. Did you place "youtube-dl" in both "system32" and "SysWOW64"? if not, could you do so and try again? I'm thinking in needs to be in both because some type of redirection is happening. if so, perhaps I could fix that. Edited December 16, 2020 by maikeru1986 Quote Link to comment Share on other sites More sharing options...
neil9000 Posted December 16, 2020 Share Posted December 16, 2020 34 minutes ago, maikeru1986 said: Well, even if it's unique to your system it's still valuable input. Did you place "youtube-dl" in both "system32" and "SysWOW64"? if not, could you do so and try again? I'm thinking in needs to be in both because some type of redirection is happening. if so, perhaps I could fix that. Yeah i did, i put it in the system32 folder first and got the image i sent you. So i then also added it to the 64 folder also, i even closed launchbox and restarted, same UI error. Hmm, now i think sorta rationally, maybe i shulda restarted Windows itself after as well, as its the Windows folders themselves. Quote Link to comment Share on other sites More sharing options...
maikeru1986 Posted December 17, 2020 Author Share Posted December 17, 2020 Hey, thanks for trying again. I think since "youtube-dl" is 32bit it is called from system32, but on 64bit systems it redirects to sysWOW64, which is why it needs to be in both. I thought this was your issue but I guess not. or maybe it's launchbox being 64bit, i honestly am not really sure. I updated it to find the system directory and call from their so you can try v0.1.1 if you want. Now "youtube-dl" only needs to be in sysWOW64. However i think its best to just put everything in launchbox's plugins directory and call it from there. will follow with another update soon. Quote Link to comment Share on other sites More sharing options...
C-Beats Posted December 17, 2020 Share Posted December 17, 2020 There any particular reason you are looking in the system folder instead of your plugin folder for the youtube-dl.exe file? Quote Link to comment Share on other sites More sharing options...
maikeru1986 Posted December 17, 2020 Author Share Posted December 17, 2020 I'm assuming launchbox may be in different locations from user to user, so this is why i went for system folder initially. I'm thinking now this is a bad idea, but am not sure how to get the plugins folder. I'm not sure if using a relative path will work. I could get it from the "videopath" then edit the path to point to the plugins folder? but that seems like a hack (would be inline witht the rest of the program though lol). Any ideas are very welcome. Quote Link to comment Share on other sites More sharing options...
C-Beats Posted December 17, 2020 Share Posted December 17, 2020 Should be able to do something similar to the below to get your plugin folder. Replace "PluginName" with the name of your plugin folder. Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).FullName, "Plugins", "PluginName") 1 Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted December 17, 2020 Share Posted December 17, 2020 2 hours ago, maikeru1986 said: Any ideas are very welcome. In VSScraper.cs, add private string pluginPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\"; In the (4) "Process youtube_dl = new Process();" sections, change: // youtube_dl.StartInfo.FileName = $@"{GetSystemDirectory()}\youtube-dl.exe"; // TO youtube_dl.StartInfo.FileName = pluginPath + "youtube-dl.exe"; And place "youtube-dl.exe" inside the ../Plugins/Vidsnap Scraper/ folder. Then there's no issue with the System32 or WoW-whatever folder issues. Well, it at least worked the one time I tried. ? 1 Quote Link to comment Share on other sites More sharing options...
maikeru1986 Posted December 17, 2020 Author Share Posted December 17, 2020 1 hour ago, C-Beats said: Should be able to do something similar to the below to get your plugin folder. Replace "PluginName" with the name of your plugin folder. Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).FullName, "Plugins", "PluginName") Great thanks. would this below also work or is it somehow bad practice or something? just curious Path.Combine(Directory.GetCurrentDirectory(), "Plugins", "Plugin_Name") should give ~Launchbox\Plugins\PluginName no? Actually realised i've used this previously in another app, such a dumbass trying to overcomplicate things. Thanks! Quote Link to comment Share on other sites More sharing options...
maikeru1986 Posted December 17, 2020 Author Share Posted December 17, 2020 5 minutes ago, JoeViking245 said: In VSScraper.cs, add private string pluginPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\"; In the (4) "Process youtube_dl = new Process();" sections, change: // youtube_dl.StartInfo.FileName = $@"{GetSystemDirectory()}\youtube-dl.exe"; // TO youtube_dl.StartInfo.FileName = pluginPath + "youtube-dl.exe"; And place "youtube-dl.exe" inside the ../Plugins/Vidsnap Scraper/ folder. Then there's no issue with the System32 or WoW-whatever folder issues. Well, it at least worked the one time I tried. ? I've just tried out @C-beats recommendation and it works fine. I'll try yours too (will just have to figure out how it works - for learing purposes). Thanks! Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted December 17, 2020 Share Posted December 17, 2020 2 minutes ago, maikeru1986 said: (will just have to figure out how it works - for learing purposes). There's a multitude of ways to get a directory/folder. The 2 suggested are just a drop in the bucket of the possibilities. The one I threw in may or may not be the best ("correct") way, but it worked. lol Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted December 17, 2020 Share Posted December 17, 2020 ...also only 2 (3 including the Readme file) files are needed. Quote Link to comment Share on other sites More sharing options...
C-Beats Posted December 17, 2020 Share Posted December 17, 2020 The way @JoeViking245 posted would work as well but you need to get the parent of that location (or should) because any calls like that will direct you to the \\LaunchBox\Core\ folder and you want to start the Path.Combine at the \\LaunchBox\ level. Quote Link to comment Share on other sites More sharing options...
maikeru1986 Posted December 17, 2020 Author Share Posted December 17, 2020 1 hour ago, JoeViking245 said: ...also only 2 (3 including the Readme file) files are needed. Thanks for the advice, just copied whatever VS game me. Is this because it's already in launchbox core folder? 1 Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted December 17, 2020 Share Posted December 17, 2020 5 minutes ago, C-Beats said: the \\LaunchBox\ level Good point! I was just getting to the ['this'] plugins folder, not the LaunchBox root folder. ? Quote Link to comment Share on other sites More sharing options...
maikeru1986 Posted December 17, 2020 Author Share Posted December 17, 2020 4 minutes ago, C-Beats said: The way @JoeViking245 posted would work as well but you need to get the parent of that location (or should) because any calls like that will direct you to the \\LaunchBox\Core\ folder and you want to start the Path.Combine at the \\LaunchBox\ level. Interesting, I've tested it out and it seems to give me the path of where the dll is. i.e. C:\Users\<Username>\LaunchBox\Plugins\Vidsnap_Scraper It seemed to me that "GetExecutingAssembly()' referred to the dll. Thanks, i'll have a look into it. Quote Link to comment Share on other sites More sharing options...
maikeru1986 Posted December 17, 2020 Author Share Posted December 17, 2020 Ive uploaded a new version. For now ive implemented what @JoeViking245 has suggested. But will look into it further. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.