Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce a specific folder structure for Extras to avoid misidentification #1338

Merged
merged 3 commits into from
May 17, 2019

Conversation

cvium
Copy link
Member

@cvium cvium commented May 1, 2019

Fixes #1278

Caveat: This change only fixes newly added media

@cvium
Copy link
Member Author

cvium commented May 1, 2019

EDIT: The following describes how to fix the database

The following must be done in a for loop, unless someone feels like writing a complex query that probably wouldn't work anyway (NOTE: ExtraIds is a pipe separated string eg. ffa2f20d-b448-2abf-7db9-8ce1893fe18b|261d4dff-8279-0921-6686-d8e0ec5dfb86|fd94e520-dc86-47e2-9948-ea4616535cca|7012b6d0-2c01-233a-e89e-9977fa47a886):

UPDATE TypedBaseItems
SET ExtraIds=REPLACE(ExtraIds, UserDataKey, '')
WHERE ExtraIds like '%' || UserDataKey || '%';

Obviously, the string replace shouldn't be done in SQL. UserDataKey is a column value taken from the following select

	select tbi2.UserDataKey
	from TypedBaseItems tbi1
	inner join TypedBaseItems tbi2 ON tbi2.Path = tbi1.Path and tbi1.Guid <> tbi2.Guid
	where tbi2.ExtraType is not null
	  and tbi1.ExtraType is null

This deletes the wrong Extras entries:

DELETE FROM TypedBaseItems
WHERE guid in (
	select tbi2.guid
	from TypedBaseItems tbi1
	inner join TypedBaseItems tbi2 ON tbi2.Path = tbi1.Path and tbi1.Guid <> tbi2.Guid
	where tbi2.ExtraType is not null
	  and tbi1.ExtraType is null
);

@lukastribus
Copy link

Does not fix the issue fully.

While new movies now do show up in the collection after adding them, they show up without any metadata associated with it.

@cvium cvium changed the title Change owner and parent id of extras to the main media item Enforce a specific folder structure for Extras to avoid misidentification May 2, 2019
@cvium cvium requested a review from a team May 2, 2019 06:34
@cvium
Copy link
Member Author

cvium commented May 2, 2019

The fix has been changed to enforce a more sane folder structure similar to Plex and Emby

@lukastribus
Copy link

lukastribus commented May 2, 2019

Patch LGTM for new movies. Thanks.

Will check the database fix later.

@joshuaboniface joshuaboniface requested a review from a team May 3, 2019 21:12
oddstr13 added a commit to oddstr13/jellyfin-fixup-scripts that referenced this pull request May 4, 2019
MediaBrowser.Controller/Entities/BaseItem.cs Outdated Show resolved Hide resolved
MediaBrowser.Controller/Entities/BaseItem.cs Outdated Show resolved Hide resolved
MediaBrowser.Controller/Entities/BaseItem.cs Outdated Show resolved Hide resolved
MediaBrowser.Controller/Entities/BaseItem.cs Outdated Show resolved Hide resolved
MediaBrowser.Controller/Entities/BaseItem.cs Outdated Show resolved Hide resolved
@lukastribus
Copy link

lukastribus commented May 9, 2019

Would it be possible to block the 10.3.3 release until this is merged? Thanks.

Untested
@cvium
Copy link
Member Author

cvium commented May 16, 2019

If someone can test my latest changes, that would be great. My initial test seems fine

@cvium cvium requested a review from Bond-009 May 16, 2019 05:38
@anthonylavado anthonylavado self-assigned this May 16, 2019
@lukastribus
Copy link

Works for me.

@joshuaboniface joshuaboniface merged commit 4de8bf3 into jellyfin:release-10.3.z May 17, 2019
@Mr-Oca
Copy link

Mr-Oca commented May 18, 2019

I'm using jellyfin in a docker on a Openmediavault NAS, and for me, the issue is still there :

  • can't add movie to a collection,
  • can't delete old collection (actualy I can delete them but they keep coming back).
    I can create new collection, but still not add movie to it.

@lukastribus
Copy link

@kjlhgfds that's expected because this fix is only about new movies added to the library. Your existing movie entries are already corrupted.

Use @oddstr13 jellyfin-collection-fix.py to fix your database.

@0ddb0d
Copy link

0ddb0d commented May 19, 2019

I'm running on a QNAP NAS and oddstr13's script worked fine using Entware's Python3. For anybody else on this platform make sure you change the DBFILE variable to point to the correct location and make sure procps-ng-ps is installed as the script won't work with Busybox ps.

Thanks @cvium, @oddstr13 and @lukastribus

Edit:- It only partially worked, my existing admin account is OK but any accounts that do not have access to all libraries still show collections with no items.

@oddstr13
Copy link
Member

I'm running on a QNAP NAS and oddstr13's script worked fine using Entware's Python3. For anybody else on this platform make sure you change the DBFILE variable to point to the correct location and make sure procps-ng-ps is installed as the script won't work with Busybox ps.

Thanks @cvium, @oddstr13 and @lukastribus

Edit:- It only partially worked, my existing admin account is OK but any accounts that do not have access to all libraries still show collections with no items.

Could you please submit issues on https://github.com/oddstr13/jellyfin-fixup-scripts ?

Include the data location on QNAP.

Also, a link to QNAP setup instructions would be appreciated, so I can test there too (I'm assuming you've installed via App Center here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants