Created
November 25, 2024 20:04
-
-
Save Beagon/47c5fba4c6ec58c1fce4e1fbc735bb6d to your computer and use it in GitHub Desktop.
Change media path for Jellyfin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- This is executed on library.db | |
| -- I merged disk1 and disk2 into one. This meant remove disk1 and disk2/media. | |
| UPDATE TypedBaseItems SET Path = replace(Path, 'disk1/', ''); | |
| UPDATE TypedBaseItems SET Path = replace(Path, 'disk2/media/', ''); | |
| UPDATE TypedBaseItems SET Images = replace(Images, 'disk1/', ''); | |
| UPDATE TypedBaseItems SET Images = replace(Images, 'disk2/media/', ''); | |
| UPDATE TypedBaseItems SET data = replace(data, 'disk1/', ''); | |
| UPDATE TypedBaseItems SET data = replace(data, 'disk2/media/', ''); | |
| UPDATE mediastreams SET Path = replace(Path, 'disk1/', ''); | |
| UPDATE mediastreams SET Path = replace(Path, 'disk2/media/', ''); | |
| -- This removes the duplicatas. Might not be perfect, but worked for me. | |
| DELETE FROM TypedBaseItems | |
| WHERE EXISTS ( | |
| SELECT 1 FROM TypedBaseItems p2 | |
| WHERE TypedBaseItems.Path = p2.Path | |
| AND TypedBaseItems.CleanName = p2.CleanName | |
| AND TypedBaseItems.DateLastRefreshed > p2.DateLastRefreshed | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment