Ascoware / get-iplayer-automator

Get iPlayer Automator allows you to let Apple's TV app and your Mac to become the hub for your British television experience.
https://ascoware.github.io/get-iplayer-automator/
GNU General Public License v3.0
147 stars 26 forks source link

Re-naming files with duplicate file name #143

Open PhoolR opened 6 years ago

PhoolR commented 6 years ago

I wonder if this is something that could be incorporated into future releases?

The issue: If there are multiple shows that have identical names (i.e. 'The Chris Evans Breakfast Show - Sara Cox Sits In' - all the shows for the week have exactly the same name), then after the first show is downloaded the rest will fail as 'already exists in location' (or something to that effect).

The solution?: If a duplicate file name already exists, the next file would append to add #2, the third #3 etc.

I don't know if this is a possibility or not, or if I'm being stupid (likely) and there is already a work-around for it.

wagnertoph commented 6 years ago

I think this is the same issue as #141 .

PhoolR commented 6 years ago

I don't think so, that's an ITV issue, the example I have given is BBC Radio... ? I'll be happy for admin to close it if they deem it to be a duplicate.

sleaux-meaux commented 6 years ago

Different code, same problem as #141. GiA overrides the default naming convention used by get_iplayer to produce unique file names, so you can encounter duplicates for BBC programmes as well. For BBC programmes, you're better off using Kodi naming because episode numbers and titles are available.

PhoolR commented 6 years ago

Except for when they're not... As is the case with my example above. 5 different programmes, all with the exact same name. Also, I already use Kodi naming.

sleaux-meaux commented 6 years ago

It is odd that you have multiple episodes with "Sara Cox sits in" as the episode name. I don't see any of those in GiA, and they don't appear in the available episodes on the iPlayer site, or in the Radio Two schedules for the past month. Even so, you can turn Kodi naming off and edit the episode names in the download queue so that each download will have a unique file name.

PhoolR commented 6 years ago

Don't get hung up on that particular name, it was an example of episodes that this has happened to in the past. A couple of weeks ago it was Jo Whiley and Anamatronic that was sitting in. The point is, when there's an episode that BBC don't name in a unique way (as happens usually when someone sits in for someone else like Sara Cox for Chris Evans) you can only download one and then have to move it or rename it before you can download the next.

PhoolR commented 6 years ago

It was just a question of whether something could be added to mean that it just adds an incremental number each time there's a duplicate file name. There's obviously no danger of downloading the same episode twice as it should already be in the download history.

sleaux-meaux commented 6 years ago

Well, the name is all in this case, but the Jo Whiley episodes you cite do provide an example. There is no reason a sequential value couldn't be appended to file names, though that would create a small risk of getting duplicate files if you delete history entries since you would be defeating the overwrite test in get_iplayer. I would vote for using the programme PID (as get_iplayer does by default) or the date/time aired. Then at least you could see which episode a file corresponds to without looking at the metadata.

sleaux-meaux commented 6 years ago

Actually, there is a problem with your suggestion of using sequential numbering. GiA would have to do an extra run of get_iplayer (without actually downloading) in order to determine what the output file name would be so that it could check for an existing file. Not terrible in itself, but GiA puts a stream identifier in the non-Kodi name, and that isn't known for sure until the download is complete. The default name template would have to change, I think, or perhaps use a temp directory.