python-plexapi icon indicating copy to clipboard operation
python-plexapi copied to clipboard

Feature: Add librarySectionTitle for playlist items

Open glensc opened this issue 1 year ago • 10 comments

Description

Similarly to https://github.com/pkkid/python-plexapi/pull/1335, add librarySectionTitle, this is present on local playlist entries.

The source attribute should be on

  • [x] Movie
  • [x] Episode
  • [x] Track
  • [x] Photo (Already present: cf56d9a13)

The diff of local/remove items can be seen here:

  • https://github.com/pkkid/python-plexapi/pull/1335#issuecomment-1880296495

Type of change

Please delete options that are not relevant.

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

Checklist:

  • [ ] My code follows the style guidelines of this project
  • [ ] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have added or updated the docstring for new or existing methods
  • [ ] I have added tests when applicable

glensc avatar Aug 31 '24 16:08 glensc

This was already present on Photo: cf56d9a13c8c8e48ed2170564bb19033f628a7c0, should other attributes like librarySectionID, librarySectionKey be added as well? Is the comment "(local playlist item only)" correct? valuable?

Also: What about tagline, titleSort?

glensc avatar Aug 31 '24 17:08 glensc

librarySectionTitle is already on the base Video and Audio object.

https://github.com/pkkid/python-plexapi/blob/master/plexapi%2Fvideo.py#L61

https://github.com/pkkid/python-plexapi/blob/master/plexapi%2Faudio.py#L74

Do those not work in playlists?

JonnyWong16 avatar Aug 31 '24 19:08 JonnyWong16

🚧 Never link to branches, share a permalink 🚧

  • see https://news.ycombinator.com/item?id=8046710 and https://help.github.com/articles/getting-permanent-links-to-files/ and https://docs.gitlab.com/ee/user/shortcuts.html#project-files
  • hit y
  • and perhaps for https://github.com/josephfrazier/octopermalinker (GitHub)

NOTE: edit your post and fix it with a permalink!

PS: gitlab has a bug and you need to reload a page before y works.

glensc avatar Sep 01 '24 09:09 glensc

I know librarySectionTitle works on Video items (Movie and Episode), the others I copied to be alike https://github.com/pkkid/python-plexapi/pull/1335

glensc avatar Sep 01 '24 09:09 glensc

Ok, misread, I see what you mean, Episode and Movie extend from Video class, so yes. they should work.

glensc avatar Sep 01 '24 09:09 glensc

🚧 Never link to branches, share a permalink 🚧

  • see https://news.ycombinator.com/item?id=8046710 and https://help.github.com/articles/getting-permanent-links-to-files/ and https://docs.gitlab.com/ee/user/shortcuts.html#project-files
  • hit y
  • and perhaps for https://github.com/josephfrazier/octopermalinker (GitHub)

NOTE: edit your post and fix it with a permalink!

PS: gitlab has a bug and you need to reload a page before y works.

Github mobile app doesn't do permalinks.

JonnyWong16 avatar Sep 01 '24 15:09 JonnyWong16

There is one problem, while assigning librarySectionTitle via Video class works, for remote items None is assigned, and accessing None triggers reload. and that reload is made to wrong server (local server)....

I've used such trickery for now:

librarySectionTitle = p.librarySectionTitle if p.__dict__.get("librarySectionTitle") is not None else None

or (easier to the eye)

librarySectionTitle = p._data.attrib.get("librarySectionTitle")

glensc avatar Sep 01 '24 18:09 glensc

Now that you bring it up, any action on a playlist item from a different server will fail (i.e. editing, playing, etc.) because of the incorrect _server object. I think the proper way to fix this (and your other related comment) is to fix it at a much lower level by setting the correct _server for the playlist object when they are built. I don't know how to do that yet, but I will think about it.

JonnyWong16 avatar Sep 01 '24 22:09 JonnyWong16

yes. removeItems fails with 404 errors, as it loads from wrong server.

glensc avatar Sep 02 '24 08:09 glensc

building a proper _server may be difficult, as it requires URL and token. or are they available from myPlex?

glensc avatar Sep 02 '24 08:09 glensc