Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: foo_youtube (Read 488356 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

Re: foo_youtube

Reply #850
Hi, I've just reinstalled the OS and I'm setting everything up again, iirc my Youtube Search items were added to the Default playlist overwriting the old ones, but at the moment I cannot reproduce that behavior and my other playlists, those i'm in when i start the search, keep getting overwritten.
I know there is in Preferences/Tools/YT Source/Search/Destination: Specific playlist, but i tried to edit '['Youtube']' %artist% with no success. Can you help me pls?

Re: foo_youtube

Reply #851
Just found out about this plugin and it seems really awesome! Been using foobar for a long time but never thought of googling foobar+youtube and here we are. I already have a few use case ideas for me. Thanks a ton for making it!

Hi,

could you add the feature, that you can refresh a youtube playlist added by "add location" ? If no, you added a "get more 50 for ''" element in the playlist after using "add location", could you just add that also for "get the first 50" as it doenst matter if things are double in the list as ill delete the list anyway before refreshing. it would be highly aweseome.

thx
This "refresh a youtube playlist added by "add location"" is something I am really interested in as well. I saw that you suggested that sebastien looked into the 3dydfy-search functionality (which I think is fy+search according to 2.0 changelog but the website still has 3dydfy-search in some places?). I am personally not having much success with it (nothing seems to happen when I click the fy+search playlist items).

One of my use cases for this plugin is to listen to a changing collaborative youtube playlist, so I would want a permanent 'Get more...' item that appends new tracks to the foobar playlist (that have been added to the youtube playlist). From what I am reading the functionality is kind of possible right now even though it is perhaps not super elegant? Any tips on how to do this?

Re: foo_youtube

Reply #852
I see. No, there are no plans to upload videos to Youtube within this component.

I was think to made this possible trough script.

I can go trough playlist.

This works: https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PL889BDECC517358C9&key=AIzaSyA17v8PuNBsIwgbxg6D78iHV-w7_dYyXPw

But how to create and add videos to user playlist?
Can someone help?

Here is the script:

Code: [Select]
function YTPlaylist(){
    this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    this.xmlhttp.open("GET", "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PL889BDECC517358C9&key=AIzaSyA17v8PuNBsIwgbxg6D78iHV-w7_dYyXPw", true);
    //this.xmlhttp.setRequestHeader("Authorization", "Bearer");
    this.xmlhttp.send();
   
   this.xmlhttp.onreadystatechange = function() {
if (this.xmlhttp.readyState == 4) {
if (this.xmlhttp.status == 200) {
var text = this.xmlhttp.responsetext;
                    fb.trace(text)
                }}}
  
  

}

YTPlaylist();



I need to use ''POST'' instead ''GET'' , something like this:

Code: [Select]
function YTPlaylist(){
    var xmlhttp = new XMLHttpRequest();
    var url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&part=snippet&key=AIzaSyA17v8PuNBsIwgbxg6D78iHV-w7_dYyXPw";

    var config = {
     "snippet": {
      "playlistId": {PLAYLIST_ID},
      "resourceId": {
       "videoId": {VIDEO_ID},
       "kind": "youtube#video"
      }
     }
    }

   xmlhttp.onreadystatechange = function() {
       if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
           var response = JSON.parse(xmlhttp.responseText);
           console.log(response);
       }
   };

   console.log(url);
   xmlhttp.open("POST", url, true);
   xmlhttp.setRequestHeader("Authorization", "Bearer {ACCESS_TOKEN});
   xmlhttp.send(config);
}
YTPlaylist();
 


Re: foo_youtube

Reply #853
hmm music play good but video dont show 'Stopped'
Live video is not supported yet. Some playback can be established if select 'LAV Splitter' in Video tab -> Media downloading, but it is far from perfect due to a lot of lags.

Hi, I've just reinstalled the OS and I'm setting everything up again, iirc my Youtube Search items were added to the Default playlist overwriting the old ones, but at the moment I cannot reproduce that behavior and my other playlists, those i'm in when i start the search, keep getting overwritten.
I know there is in Preferences/Tools/YT Source/Search/Destination: Specific playlist, but i tried to edit '['Youtube']' %artist% with no success. Can you help me pls?
Use search panel config (where 'Order by relevance' etc. are placed). Column 'Playlist' there controls destination playlist for search results.

This "refresh a youtube playlist added by "add location"" is something I am really interested in as well. I saw that you suggested that sebastien looked into the 3dydfy-search functionality (which I think is fy+search according to 2.0 changelog but the website still has 3dydfy-search in some places?). I am personally not having much success with it (nothing seems to happen when I click the fy+search playlist items).
In case of playlists in 2.0 you would need fy+playlist scheme. Example, can be added as is via 'Add location':
Code: [Select]
fy+playlist://youtube.com?id=UU16niRr50-MSBwiO3YDb3RA&limit=50
'limit' is the number of results to get (1-50). Other than that playlist scheme does not have any useful params (it retrieves items ordered by upload date and without any filtering).

Re: foo_youtube

Reply #854
Can subtitles for a clip be fixed in some way as to display those ugly entities with their corresponding characters?


Re: foo_youtube

Reply #855
Yes, will be fixed.


Re: foo_youtube

Reply #857
Oops. Thanks.

Re: foo_youtube

Reply #858
@3dyd :
I'm encountering the following bug, though I'm not sure if the source of the problem is actually foo_youtube:

Repro steps (a bit vague):
1. JScript panel, which calls utils.GetAlbumArtAsync(... metadb = fb.GetNowPlaying() ...) from on_playback_new_track callback.
2. Load a playlist with youtube tracks and start playing random track from it.
3. Wait for player to switch to the next track, or do it manually.

Expected result:
on_get_album_art_done callback receives a loaded art, i.e. image and image_path arguments of callback are not null.

Actual result:
Sometimes on_get_album_art_done callback does not receive any art, i.e. image and image_path arguments of callback are null.

Calling utils.GetAlbumArtAsync again after track started playing loads art correctly.
There are also no problems with loading art when playing local tracks (e.g. mp3).

This problem might lie in my code, JScript or foobar itself, but may be it's a known problem with a possible workaround?

Re: foo_youtube

Reply #859
Since it seems to work if you try again, why not add a delay using window.SetTimeout?

Code: [Select]
window.SetTimeout(function () {
    utils.GetAlbumArtAsync(...);
}, 500); //time here is milliseconds

edited for idiocy - I originally said SetInterval   ::)

Re: foo_youtube

Reply #860
but may be it's a known problem with a possible workaround?
If it is in this component, it is unknown problem.

You could try to reproduce it while recording component's log (hold Shift key -> menu View -> Youtube Source Log -> Right click -> Record). Then inspect recorded file for anomalies or send it to me.


Re: foo_youtube

Reply #862
Two observations , feature requests - if possible - regarding the video options.

1. The option to show subtitles initially also for LRC files. 
Would be great to always load lyrics someone has made for a clip without having to always manually select it from the popup menu. 

2. When playing local video files split with chapters the video always restarts to the beginning of the file when the next subsong index is played instead of displaying the video at the correct time.

Thanks .
 

Re: foo_youtube

Reply #863
Sounds feasible. Both will probably be in next version.

Re: foo_youtube

Reply #864
3dyd I have one question..

Would all "3dydfy" will be changed to "fy+" and "fy_" and when?
It is important to know what should i change.

Example, "&3dydfy_alt_length=" still works, but if i change that to "&fy_alt_length=" then it doesnt.

Thanks.

Re: foo_youtube

Reply #865
Ah, yes, that was not mentioned. Length and any supported property (title, thumbnail_url, view_count etc) can be passed using fb2kx_ prefix (fb2kx_length, fb2kx_thumbnail_url). When adding a clip, they are stripped from URL and corresponding properties are stored to the cache (without overwriting existing ones).

Re: foo_youtube

Reply #866
Ah, yes, that was not mentioned. Length and any supported property (title, thumbnail_url, view_count etc) can be passed using fb2kx_ prefix (fb2kx_length, fb2kx_thumbnail_url). When adding a clip, they are stripped from URL and corresponding properties are stored to the cache (without overwriting existing ones).

Thanks :)

Re: foo_youtube

Reply #867
Sounds feasible. Both will probably be in next version.
Two observations , feature requests - if possible - regarding the video options.

1. The option to show subtitles initially also for LRC files. 
Would be great to always load lyrics someone has made for a clip without having to always manually select it from the popup menu. 

2. When playing local video files split with chapters the video always restarts to the beginning of the file when the next subsong index is played instead of displaying the video at the correct time.

Thanks .
 

Thanks first of all for the fixes with 2.1 beta 1.  :)

Beta feedback.

1. LRC auto-loading works as expected.

2. Chapter support works with MKV files.
With MP4 files the video window is one chapter behind. :o


Re: foo_youtube

Reply #868
Reproduced, thanks. Subsongs (playable_location::get_subsong) in MP4 are zero-based, when in MKV they are 1-based, so we have one chapter behind. With that said, there seems to be no reliable approach to get correct offset. But anyway, some ugly fix is doable.

UPD: removed incorrect observation.

Re: foo_youtube

Reply #869
If it is in this component, it is unknown problem.

You could try to reproduce it while recording component's log (hold Shift key -> menu View -> Youtube Source Log -> Right click -> Record). Then inspect recorded file for anomalies or send it to me.
Since it seems to work if you try again, why not add a delay using window.SetTimeout?

Okaaaaaaaaaaaaaay. I have investigated a little more, and here is what I've found:

Code: [Select]
function on_item_focus_change() {
    //GetArt_Immediate();
    //GetArt_WithInterval();
}

function on_get_album_art_done(metadb, art_id, image, image_path) {
    fb.trace(metadb.path);
    fb.trace('image fetched: ' + !!image);
}

function GetArt_Immediate() {
    utils.GetAlbumArtAsync(window.ID, fb.GetFocusItem(), 0);
}

function GetArt_WithInterval() {
    var albumTimer = window.setInterval(function () {
        utils.GetAlbumArtAsync(window.ID, fb.GetFocusItem(), 0);
        window.ClearInterval(albumTimer);
        albumTimer = null;
    }, 200);
}

If GetArt_Immediate() is used, then everything works fine. BUT! If GetArt_WithInterval() is used, then sometimes there will be no image :\
It fails only when metadb is from foo_youtube, there is no problems when used on local tracks.
Problem reproducible both when art is not downloaded and when it was already preloaded.

PS: 'Youtube Source Log' is empty when art is preloaded.

[EDIT]: I think, I'm getting somewhere:
Code: [Select]
function on_item_focus_change() {
    GetArt_Immediate();
    GetArt_Immediate();
    GetArt_Immediate();
}
When multiple immediate calls are used it fails as well.
So, it might have something to do with file locks: since GetAlbumArtAsync is allegedly asynchronous, each call spawns a thread that tries to access the same file, thus possibly blocking other threads from accessing it.

Re: foo_youtube

Reply #870
Why are you making up bullshit scenarios that you'll never encounter in real world usage?

Also, explain why you're using utils.GetAlbumArtAysnc in the first place? Since the path returned for youtube items is the same as the handle path, it serves no purpose and I have no idea why you're doing it.

Re: foo_youtube

Reply #871
Why are you using window.setInterval instead of window.setTimeout if you want it to run once?
You added window.ClearInterval(albumTimer)  inside the function so it will only run once and not at  interval.

If there no particular  reason to use utils.GetAlbumArtAsync, consider using utils.GetAlbumArtV2.


Re: foo_youtube

Reply #872
Why are you making up bullshit scenarios that you'll never encounter in real world usage?

Also, explain why you're using utils.GetAlbumArtAysnc in the first place? Since the path returned for youtube items is the same as the handle path, it serves no purpose and I have no idea why you're doing it.

Thank you for your kind words -_-.

Regarding GetAlbumArtAsync usage see below.

Why are you using window.setInterval instead of window.setTimeout if you want it to run once?
You added window.ClearInterval(albumTimer)  inside the function so it will only run once and not at  interval.

If there no particular  reason to use utils.GetAlbumArtAsync, consider using utils.GetAlbumArtV2.
It was just a dirty copy-paste-edit from my code, so yeah such Interval usage is equivalent to Timeout here.

I thought that GetAlbumArtAsync is asynchronous, while GetAlbumArtV2 just hangs fb2k process until art is loaded. Was I wrong?

Re: foo_youtube

Reply #873
In any case, such use case may reveal a bug, which is much harder to catch under other circumstances.

@TheQwertiest
I'll try with multiple GetArt_Immediate, thank you.

PS: 'Youtube Source Log' is empty when art is preloaded.
It may contain some hints if severity is set to 'trace' (right click in Log window -> core -> trace)

Re: foo_youtube

Reply #874
Is there a way to disable writing metadata for Youtube track? I try to embed cuesheet to the track and track's current title overrides "performer" value specified in CUE.
🇺🇦 Glory to Ukraine!