1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Lack of Interest Youtube Playlist URL ignore or support

Discussion in 'Media Gallery Closed Suggestions' started by SneakyDave, Dec 5, 2014.

  1. SneakyDave

    SneakyDave Well-Known Member

    This might be considered a bug, too(?)

    I would like to suggest that when entering youtube URL's that contain a list tag such as:
    https://www.youtube.com/watch?v=239qXZeuE4Y&list=UUtCitcCMxSmWNkVBuQ-ydOw

    That the &list tag is ignored when generating a thumbnail for the embedded video, as it doesn't seem to work correctly.

    Or perhaps support the list tag somehow when entering those URL's, but I'm not sure how helpful they would be in the Media Gallery.
     
    Last edited: Dec 5, 2014
    kontrabass likes this.
  2. kontrabass

    kontrabass Well-Known Member

    Here here! Very inconvenient that youtube url's with a list tag get no thumbnail. At least 50% of the youtube media uploads we get have a list tag (and no thumbnail) :(
     
  3. Chris D

    Chris D XenForo Developer Staff Member

    It works for me...

    There's really no reason why it shouldn't. As long as it is a valid media site URL, which this should be:



    (It should embed automatically)

    The only bit of information that is used to fetch the thumbnail is the video ID so if it gets a video ID, it will get a thumbnail and it works here:

    upload_2015-1-12_10-40-16.png
     
  4. jOOc

    jOOc Active Member

    The thumbnail were gone for me to until I uninstalled s9e Media BBCodes pack and restored the default media BB codes. After that thumbnails works OK for your link.
    So maybe how @JoshyPHP's addon work with YT thumbnails is different then default.
     
  5. Chris D

    Chris D XenForo Developer Staff Member

    If that is the case, we really have no control over modifications made to the way default media sites are processed, or additional ones that are added.

    I would hazard a guess, that there may be an additional media site that kicks in when there is a list parameter in the URL. XFMG will only create thumnnails for sites it explicitly knows about, otherwise custom code would need to be developed to get the thumbnail.

    See Gallery Options > Media Site Options and the files in library/XenGallery/Thumbnail for examples.
     
  6. JoshyPHP

    JoshyPHP Well-Known Member

    If @kontrabass uses my add-on, the YouTube playlist link from above will generate the following BBCode:
    Code:
    [MEDIA=youtube]id=239qXZeuE4Y;list=UUtCitcCMxSmWNkVBuQ-ydOw[/MEDIA]
    ...which I guess trips your thumbnail class. The same applies to links with a timestamp or any feature that is not supported by the default YouTube media site.
     
    SneakyDave and Chris D like this.
  7. kontrabass

    kontrabass Well-Known Member

    Thanks for the input. I think I'm reading this right... so in order for youtube links with a playlist to generate thumbnails in XMG, I need to restore the default XF youtube media site code?
     
  8. JoshyPHP

    JoshyPHP Well-Known Member

    The default YouTube media site does not support playlists at all so you'd be better off posting videos without the playlist (without &list=...) in your gallery.

    If you don't care about playlists then you may reinstall the default YouTube definition and you won't know the difference. Ideally, it would be best to support both in the Media Gallery's thumbnail class. @Chris D If you want to support both, here's how I extract vars from the media key:
    Code:
    $vars = array('id' => $mediaKey);
    if (preg_match('(^(\\w+=[^;]*)(?>;(?1))*$)', $mediaKey))
    {
        foreach (explode(';', $mediaKey) as $pair)
        {
            list($k, $v) = explode('=', $pair);
            $vars[urldecode($k)] = urldecode($v);
        }
    }
    
    It handles both forms:
    Code:
    [MEDIA=youtube]239qXZeuE4Y[/MEDIA]
    [MEDIA=youtube]id=239qXZeuE4Y;list=UUtCitcCMxSmWNkVBuQ-ydOw[/MEDIA]
    
     
    kontrabass likes this.
  9. Chris D

    Chris D XenForo Developer Staff Member

    It's not so much what the code is, we're fine with that. It's more a question as to whether we should support that in the core from the point of view that we obviously can't support everything that is "third party". Though I do appreciate your comments on some potential improvements from a while ago.

    It'll probably be a different solution but I'll come up with something later.
     
    kontrabass likes this.
  10. JoshyPHP

    JoshyPHP Well-Known Member

  11. Chris D

    Chris D XenForo Developer Staff Member

    This should help.

    I stole most of your code @JoshyPHP seeing as it was already written, to save me some time, thanks for that ;)

    However, we're not going to be changing anything in the core of XFMG for reasons stated, but this should work.

    This file needs to be uploaded to a new directory that you will need to create:

    library/XenGalleryThumbnails/YouTube.php

    (so, create a directory named XenGalleryThumbnails and then upload the attached YouTube.php to that).

    Then edit your Gallery Options > Media Site options. In the "Media Site Thumbnails" section, next to "YouTube" change the value to "XenGalleryThumbnails_YouTube".
     

    Attached Files:

    SneakyDave likes this.
  12. kontrabass

    kontrabass Well-Known Member

    Thanks for this Chris & Josh! I created the file, modified the Media Site options as instructed, and then I rebuilt gallery thumbnails. Any YouTube video I upload, playlist tag or not, generates a thumbnail now. (y)

    There's just one oddity that I can live with: even after rebuilding thumbnails and purging the CDN, some older youtube videos have no thumbnail, even without playlist tags (see http://www.talkbass.com/media/categories/solo-bass-guitar.12/?page=3). No matter what I try I can't get a thumbnail on these. Like I said, I can live with this. All new uploads seem to generate thumbnails fine. :cool:
     

Share This Page