Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

[Feat]: Upgrade Music Video from YouTube to Tidal #208

Closed
Hendo16 opened this issue Mar 3, 2023 · 6 comments
Closed

[Feat]: Upgrade Music Video from YouTube to Tidal #208

Hendo16 opened this issue Mar 3, 2023 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@Hendo16
Copy link

Hendo16 commented Mar 3, 2023

I know this functionality doesn't exist just yet but if we provide an additional parameter to allow for a video upgrade, it'd be great if there was a way the application could, instead of skipping artists it's already downloading, check all of the songs again in MusicBrainz to see if a tidal video link. Maybe when songs are downloaded an attribute is added to the nfo to flag if it was from youtube or tidal - that way as the database grows and higher quality videos are linked it'll get upgraded when the script is run.

@RandomNinjaAtk
Copy link
Owner

This is a good idea, I'm just not sure if anyone is actually populating the database with links... Would be nice if they did...

The script already prefers tidal when possible.

@RandomNinjaAtk RandomNinjaAtk added the enhancement New feature or request label Mar 3, 2023
@Hendo16
Copy link
Author

Hendo16 commented Mar 6, 2023

Well since finding this service, i've been working on the MusicBrainz DB, made over 1000 edits which include adding music videos so that this script will detect it, and adding Tidal video links where possible. But it's been getting frustrating since sometimes the cached MusicBrainz DB won't detect that it needs to update so i'll need to manually delete the cache alongside the artist 'completed' file for the service to actually download the latest video, and there's been multiple instances where it will pull a youtube link from IMVDB and download that song anyway, meaning there's two identical videos yet ones of a higher quality since it was pulled from Tidal. It'd be good if we could bypass IMVDB and only use that as a backup since MusicBrainz seems more flexable and easier for general users to update

@RandomNinjaAtk
Copy link
Owner

RandomNinjaAtk commented Mar 6, 2023

I would prefer to use musicbrainz as the only source, but the lack of videos linked, meant that IMVDB was necessary. Because the script is using both sources, the only valid way to really check for duplicates, is by file name, and that is not ideal because if title names or simple capitalization differences can cause a duplicate... Its not an easy problem to solve... Using a single database is much simpler to solve the issue but that also requires the community to step up and take action, which it appears that you've been doing so, so great job working on that.

Right now the script waits 7 days before re-checking musicbrainz for cache differences, see here:

if [ -f "/config/extended/cache/musicbrainz/$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json" ]; then
if ! [[ $(find "/config/extended/cache/musicbrainz" -type f -name "$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json" -mtime +7 -print) ]]; then
log "$processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: Previously cached, skipping..."
return
fi
fi

After a 7 day timeout, it will then compare the cached number of recordings vs the online db number of recordings:

if [ -f "/config/extended/cache/musicbrainz/$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json" ]; then
musicbrainzArtistDownloadedRecordingsCount=$(cat "/config/extended/cache/musicbrainz/$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json" | jq -r .id | wc -l)
if [ $musicbrainzArtistRecordingsCount -ne $musicbrainzArtistDownloadedRecordingsCount ]; then
log "$processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: Previously cached, data needs to be updated..."
rm "/config/extended/cache/musicbrainz/$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json"
fi
fi

If the Musicbrainz online db has more recordings, then the local cache is updated. So it will not detect changes, if the recording account stays the same, and you only add a url to an existing recording.... Don't think there is a better way to handle it honestly....

So here are some ideas I have that could potentially improve things based on the discussion here:

  1. Make IMVDB or Musicbrainz optional, there would be no fallback mechanism
  2. Remove the 7 day cache timeout for musicbrainz, forcing it to check for new recordings everytime the script runs. (should likely reduce the need for manual cache wipes.)
  3. When the local cache receives an update, remove the artist completed file to allow it to re-process the artist automatically.
  4. Add a source tag to the nfo's to attempt to detect and upgrade files (adding this feature would likely cause every existing file to be re-downloaded...)

Let me know your thoughts.

RandomNinjaAtk added a commit that referenced this issue Mar 6, 2023
#208 

Addresses items 2 & 3 from: #208 (comment)

It removes the caching timeout and if the local cache is updated, it removes the log file that prevents the artist from being processed by the script.
@RandomNinjaAtk
Copy link
Owner

RandomNinjaAtk commented Mar 6, 2023

2 & 3 have been implemented, but have not been tested....

RandomNinjaAtk added a commit that referenced this issue Mar 6, 2023
#208 - Partial implementation of item 4....
@RandomNinjaAtk RandomNinjaAtk reopened this Mar 6, 2023
RandomNinjaAtk added a commit that referenced this issue Mar 6, 2023
… version

#208 

Process is this:
Add source tag as "youtube" to all existing nfo's, this is because there is no way accurately track previous downloaded files....
Then any youtube sourced file will be upgraded if a "tidal" sourced file is available that has the same file name. This does result in all previous "tidal" files being re-downloaded, but much better than all files being downloaded...
@RandomNinjaAtk
Copy link
Owner

2, 3 & 4 should now be implemented.

RandomNinjaAtk added a commit that referenced this issue Mar 6, 2023
…ivity

#208 - Attempt to prevent dupes by ignoring filename case-sensitivity
@RandomNinjaAtk
Copy link
Owner

The dupe detection change seems to possibly eliminate the need for 1. Give the latest updates a try and see what you think... I think this is fully implemented now....

@RandomNinjaAtk RandomNinjaAtk self-assigned this Mar 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants