jc21 / plex-api

PHP API for Plex Servers
Other
35 stars 8 forks source link

Fixes and updates #15

Closed godsgood33 closed 1 year ago

godsgood33 commented 1 year ago

Made the fixes that delovelady asked about in issue #13 & #14 . Also, added parsing for Music libraries. Photo libraries are going to need a lot of thought before implementing that. Lastly, fixed some other various bugs and added PHPUnit and Dotenv for dev unit testing.

I also added a call to the /myplex/account that was asked for in #11 . #8 should also be fixed because I never saw the issue in my testing. I also added delovelady's code snippet in his last comment.

To do unit tests, update to this version, then run composer test. The setup method will check your environment variables and tell you want to do next. I set up a .env file in the tests directory that looks like this.

#[Server]
PLEX_HOST={IP of Plex server}
PLEX_PORT={Port Plex is running on}
PLEX_TOKEN={Plex Token}
###  If you don't know your Plex token you'll have to put in your username and password as below
#PLEX_USER={Plex username}
#PLEX_PASSWORD={Plex password}

PLEX_SSL=0 or 1 # if you're using SSL for your Plex server

#[Movies]
MOVIE_TESTS=0|1    # do you want to run the tests for the movie environment, if not, rest of the MOVIE_\* can be left out
MOVIE_SECTION_KEY={section key id}    # can be found by running `composer section`
MOVIE_ITEM_ID={Item id that is used in queries}  # run `composer item` to see what is available once you've put in a section key
MOVIE_SEARCH_QUERY={movie title}   # a title string that should result in finding a movie (case-insensitive, if non-alphanumeric present surround with double-quotes)
MOVIE_FILTER_QUERY={movie title}       # a title string that can used to filter for a movie (case-sensitive, might present a problem if too ambiguous, if non-alphanumeric present surround with double-quotes)
MOVIE_FILTER_QUERY_SIZE={size in bytes}    #of the movie from MOVIE_FILTER_QUERY

#[TV]
TV_TESTS=0|1    # do you want to run the tests for the TV environment, if not, rest of the TV_\* can be omitted
TV_SECTION_KEY={section key id}   # can be found by running `composer section`
TV_ITEM_ID={item id that is used in queries}   # run `composer item` once you've put in a section key to see 10 options
TV_SEARCH_QUERY={episode title}   # episode title that can be used in query (case-insensitive, if non-alphanumeric surround present with double-quotes)
TV_FILTER_QUERY={show or episode query}   # title of show or episode used in filtering (case-sensitive, if non-alphanumeric present surround with double-quotes)

#[Music]
MUSIC_TESTS=0|1   # do you want to run the tests for the music environment, if not rest of MUSIC_\* can be omitted
MUSIC_SECTION_KEY={section key id}  # can be found by running `composer section`
MUSIC_SEARCH_QUERY={search string}   # artist/album/track search string (if non-alphanumeric present, surround with double-quotes)
MUSIC_FILTER_QUERY={search string}   # artist/album/track query string (case-sensitive, if non-alphanumeric present, surround with double-quotes)
godsgood33 commented 1 year ago

@jc21 Hey, just curious if there is anything else you'd like from me to pull this?