View Single Post
  #4049  
Old 26.11.2020, 17:33
BillyCool BillyCool is offline
Super Loader
 
Join Date: Sep 2016
Location: Australia
Posts: 28
Default

Just want to add that I'm experiencing the issue with missing filenames as well. From experience, this is not a new thing but now it happens the majority of the time. The issue appears to be with the pre-defined variables.

Example link: **External links are only visible to Support Staff****External links are only visible to Support Staff**

Some more info that might prove useful. I have an event script that automatically queries and downloads youtube videos using the JD API. For the past few weeks, I noticed that some links would randomly come through without a name. I tried to correct the issue myself by updating the name manually, but I then noticed that a lot of the time, that didn't work either, making me believe this is an issue with JD and not the plugin.

My filename format in the plugin is set to:
Code:
*CHANNELNAME* - *DATE[yyyy-MM-dd]* - *VIDEO_NAME*.*EXT*
And my filenames would sometimes come out as:
Code:
- -
As you can tell, the variables resolved to empty string.

These are 2 functions I wrote in my script to try and work around the issue:
Code:
function getNameSafe(link) {
    var newName = link.getName();
    var count = 0;

    // Try to avoid JD bug
    while (newName == "-  - " && count < 100) {
        newName = link.getName();
        count++;
    }

    return newName;
}

function setNameSafe(link, newName) {
    var count = 0;

    // Try to avoid JD bug
    while (getNameSafe(link) != newName && count < 100) {
        link.setName(newName);
        count++;
    }

    return newName;
}
The idea was to try up to 100 times to get/set the name correctly. But, teven this didn't work and my logs were very confusing. Here is another snippet of my script that is responsible for this renaming:

Code:
var newName = getNameSafe(crawledLink);
log("Setting new name to: " + newName);
setNameSafe(existingLinkByUrl, newName);
log("Done, name set to: " + existingLinkByUrl.getName());
The logs from that snippet made no sense sometimes, here's a recent one:
Code:
Setting new name to: vTuned garage - 2020-11-23 - Stripping the Interior on my McLaren 720s - Episode 6.mkv
Done, name set to: -  - .mkv
As you can see, the getNameSafe() function correctly got the proper filename but setNameSafe() failed to set it properly. I have also seen the reverse happen. These functions use the standard event scripter functions, so shouldn't be affected by the Youtube plugin itself. This is what led me to believe the bug was somewhere else.

Hope this helps, happy to provide any more info if needed.
Reply With Quote