/*Disclaimer
*
*The usage of this script must comply with the Reddit API Terms of Use
*https://www.reddit.com/wiki/api
*I will not be responsible for any modifications of the script made by the end users that do not comply with the terms.
*
*Credits:
*Original concept (Subreddit to YouTube Source Bookmarklet) from https://gist.github.com/akaleeroy/b3de63c46ee43d413913
*
*Description:
*Search subreddits for youtube/vimeo/spotify url's and create a playlist within foobar2000.
*
*Required components:
*JScript Panel (http://www.foobar2000.org/components/view/foo_jscript_panel) and
*Youtube Source (http://fy.3dyd.com/download/)
*foo_input_spotify (https://github.com/stengerh/foo_input_spotify) Spotify support for foobar2000. Requires a Spotify premium account.
*
*Optional components:
*m-tags (http://www.foobar2000.org/components/view/foo_tags)
*
*Installation:
*Create an empty jscript panel and import the script.
*Modify the script with your oauth2 credentials / or add them in the jscript panel properties.
*username and password are your reddit credentials.
*You must authorize with your account @ https://www.reddit.com/prefs/apps/ as your personal script to get your client_id and client_secret keys.
*See https://github.com/reddit/reddit/wiki/OAuth2 , https://github.com/reddit/reddit/wiki/OAuth2-Quick-Start-Example
*
* example:
* var username = window.GetProperty("Reddit.username", "redditusername");
* var password = window.GetProperty("Reddit.password", "redditpassword");
* var client_id = window.GetProperty("Reddit.client_id", "redditclientid");
* var client_secret = window.GetProperty("Reddit.client_secret", "redditsecret");
*
*/
Tried it, works, thanks! 8)
Version 0.0.2
ADDED: Search by query.
ADDED: Visit Reddit comments for current playing item
CHANGE: Made Spotify optional component
Script no longer works nowadays. I get this:
Reloading or fiddling with the config doesn't help.
It it still working with JScript Panel v.1.3.0
Can you provide an output from the console panel where it crashes?
It it still working with JScript Panel v.1.3.0
Same version here. Something else was wrong with my config, because another JScript panel crashes too (YouTube Track Manager).
Found the relevant log info:
JScript Panel: This component requires your system has IE9 or later installed.
So the solution is to install Internet Explorer 9 or later.
The breaking changes for v 1.3.0 are described here:
https://github.com/19379/foo-jscript-panel/wiki/Breaking-Changes
You can downgrade to v1.2.4 if you wish.
https://hydrogenaud.io/index.php/topic,110499.msg945412.html#msg945412
@zeremy,
great job
@zeremy foo_jscript_panel (https://github.com/marc2k3/foo_jscript_panel) introduced breaking changes in v2.0.0 (https://github.com/marc2k3/foo_jscript_panel/wiki/Breaking-Changes#v200) that require updating your script:
fb.Trace has been removed and replaced with a native console.log method so you'll need to do a simple find/replace in all your scripts. It takes multiple arguments as before.
window.GetColorCUI -> window.GetColourCUI
window.GetColorDUI -> window.GetColourDUI
Updated to Jscript Panel v2+
Some hints for installation for the 'non-experts':
- foo_input_spotify or a Spotify Premium Account is not required
- to get the reddit credentials:
- register at reddit to get username and password
- to get client_id and client_secret:
- click here: https://www.reddit.com/prefs/apps/ (https://www.reddit.com/prefs/apps/)
- in the template fill any name at the field 'Name'
- check 'script'
- Type any description
- leave 'about url' blank
- at 'redirect url' type 'http://107.0.0.1:65010/authorize_callback' (that did at least work for me, don't ask me why)
- then confirm and you see something like this:
- the red underline string is the client_secret, the string 'p-jcoL...' right to the app icon on top of the page is the client_id
- then include username, password, client_id, client_secret in the header of the js code as described by zeremy
- when first using the code the script crashed. Fix: I had to create the folder media\r2ys manually in my foobar directory (using portable installation)
- then the plugin worked great :)
- in my skin the panel appeared to be white text on white background (referring only to status message, left-click reddit functions worked well). Fix: underlying PSS with black background and click 'pseudo-transparent' in the js panel
And then: enjoy ;D Thanks to zeremy!
Updated to Jscript Panel v2+
I didn't have the media folder in
fb.ProfilePath and it errored when it was supposed to create it with
objFSO.CreateFolder(path);:
Microsoft JScript runtime error:
Path not found
Problem was solved by creating the
media folder manually in
shell:AppData\foobar2000\I uncommented
//gr.FillSolidRect(0, 0, ww, wh, g_backcolor); as well because the background was white and you couldn't see the text.
v.0.0.4
+Fix path creation
+Fix colours
thanks
@MojoBass @onirwai for reporting.
After the first shot where I had no problems to connect to reddit, I wanted to change my password (as I did not want to ues one of my 'good' passwords here). Old clident id with new pwd did not work, so I generated a new script and new client id and secret. However, since then I am not able to connect, not even with a fully new login at reddit (new email, new user,...). Any hints?
Try clearing the panel's properties and reload.
Right click the panel > Select Properties > Press the clear button > Apply.
Thanks very much!! Now works again perfect! (can't explain why I didn't even look into the properties.....)
To get it to work with JScript v2.3+:
Fix
utils.CheckComponent(..) calls to only take first parameter
utils.CheckComponent(name) (boolean)
/*
The previously optional "is_dll" parameter was removed in v2.3.0.
The filename is now always checked (equivalent to "is_dll" being true).
Example:
console.log(utils.CheckComponent("foo_playcount"));
*/