tubesync
tubesync copied to clipboard
Improve renaming
Basically I think the "folder name" and "video name" should be only one input, like it is in many similar software. It would allow multiple things such as:
-
Using {{tags}} in the root folder name and sorting out in different folder videos per channel, per date, per formats, etc...
-
Instead of having a root Source/ Directory when downloading from a playlist, have the options to save them in the root video folder under their channel name.
For example instead of :
/videos /Playlist1 /Playlist2
I would get
/videos /Channel 1 /Channel 2
Even if Channel 1 and 2 have videos coming from two different sources
I can see the point of this. It might be easier to implement as a "use channel name as directory name" override flag. I'll look into how easy this is to implement without breaking any existing deployments.
EIther way would work, I just think that in order to future proof the feature, having a free text template would be more flexible than a checkbox, especially since that input text already exist, all you have to do is remove the Source directory and allow slashes in that input text if it doesnt already allow them
That would break all current installs of TubeSync without a reasonably annoying attempt at an auto-migration of merging the current directory field into the path template before removing it.
Hmm if you change the default without removing the field that would be retro-compatible no? It would look like this for example

as a ref, this is what it looks like in -arr softs:

Sure, but people likely haven't used the channel name directly as the folder name. Any mismatch at all would result in it breaking when you update, even if it's changing the directory from "my-channel" to the actual accurate name "My Channel".
Yes but people who have migrated from older version will have values in "Directory (Optional)" (the Source Directory name) so it wont change anything for them the file will end up at the same place, this change would only be relevant to new sources Or may be I misunderstand what you mean
Yeah that could work, your prior suggestion was to remove the directory field entirely which is what would cause the issues. I'll look into adding directory support to the file name format field first.
Linked to this enhancement would be the desire to have {channel_id} exposed as a variable in folder naming in order to get folder names like linustechtips [youtube-UCXuqSBlHAE6Xw-yeJA0Tunw] created. This can then be used/read by the likes of https://github.com/ZeroQI/YouTube-Agent.bundle which needs the likes of Youtube/%(uploader)s [%(channel_id)s]/%(playlist_index)s - %(title)s [%(id)s].%(ext)s passed to the yt-dl'er, and resulting in a path/filename format like Youtube\Errant Signal [UCm4JnxTxtvItQecKUc4zRhQ]\001 - Thanksgiving Leftovers - Battlefield V [Qgdr8xdqGDE]
...and linked to that would be nice to have an option to invoke --restrict-filenames to restrict filenames to only ASCII characters, and avoid "&" and spaces in filenames, makes the filenames slightly messy but no crash of the Agent due to unsupported characters
I would love a flag that is just {channel_name} or whatever to use in my own renaming. If I could get something like this working:

Although I also run into another error where I cannot use the same directory name more than once too.
Shouldn't something like this work?
https://github.com/ajquick/tubesync/commit/901355214a8b871394e7d37da362285e61467cb0
Adding the channel variable is as easy as adding?
'channel': self.uploader,
Most of the time, right now, yes. The uploader is from the video metadata and doesn't return a sensible name 100% of the time in practice. It's most of the time the channel name, can be a channel ID, might also be a playlist ID. Changing the directory to not unique is also possible, but obviously it's going to merge content into a single directory as nested directories isn't supported yet. If your media format actually works in your screenshot then that's been added to yt-dlp since the last time I tested it and isn't something I've explicitly added. The uploader isn't used for much right now because it has been unreliable in the past and might unreliable in the future.
If it stabilises and becomes reliable it might be an easy solution.
Ideally, the channel name needs to be detected when you first add a source and playlist or channel metadata stored at a source level not just per media item.
Happy to accept PRs for changes, of course.
I don't have a way to test to see if it would work and I don't want to add instability in case it isn't a good change. Do you think it would work?
Use of %(uploader) does seem to be a valid way to put into other directories in the yt-dlp examples.
What I am looking at doing is importing a few playlists that contain thousands of videos.
Online Show / Uploader Name / Season # / Epsiode Title #.mkv
There is a playlist for each season with all the videos, but each uploader has their own perspective episodes.
I imagine it would be extremely useful for playlists of music videos where the uploader (artist) has their own folder.
That sounds a reasonable use case. I've not checked the feature stability support for a few months so I'll re-check to see if this is sensible to add now. Cheers for the suggestion.
Just wanted to check in and see if the changes I proposed (https://github.com/ajquick/tubesync/commit/901355214a8b871394e7d37da362285e61467cb0) would work?
I'd love to just have the ability to have the Channel Name available for renaming and folders. I don't know how to modify the code to test on a docker however.
Yes, but occasionally the uploader might be something like a random hash prefix or other seemingly nonsensical string. Likely, the string also needs to be slugify()'d before using it in directory_path or if the uploader as emotes in or something downloads will fail for people who save videos to some kinds of network mounts etc. (that don't support full unicode).
Also, allowing multiple sources to write to the same directly will probably cause some issues somewhere.
In summary, yes it should be OK, with the exception of a few edge cases. If you want to submit a PR feel free, I'll review and tweak it. Please also remember to update the example path formatting docs with the new option as well.
i'm trying this out right now and not being able to nest folders like putting playlists under a channel makes organizing things difficult.
Any update on this?