Skip to content

Commit

Permalink
Comment on demo data
Browse files Browse the repository at this point in the history
  • Loading branch information
Erotemic committed Sep 12, 2024
1 parent 7d1d6db commit 720f1e5
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions jellyfin_apiclient_python/demo/demo_jellyfin_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ def __init__(self):
# config_dpath = (test_dpath / 'config').ensuredir()

def ensure_server(self, reset=False):
"""
Main entry point that will quickly check if a server exists, and if it
does not it will set up a small one for testing purposes. By passing
reset=True you can delete an existing server and force a fresh start.
"""
if reset:
self.teardown_existing_server()

Expand All @@ -52,9 +57,12 @@ def ensure_server(self, reset=False):
self.populate_demo_media()

def server_exists(self):
oci_container_name = 'jellyfin-apiclient-python-test-server'
"""
Returns:
bool: True there is a container running the jellyfin server
"""
info = ub.cmd(f'{self.oci_exe} ps', verbose=self.verbose)
return oci_container_name in info.stdout
return self.oci_container_name in info.stdout

def teardown_existing_server(self):
"""
Expand Down Expand Up @@ -164,6 +172,10 @@ def ensure_local_demo_media(self):
ub.grabdata('https://upload.wikimedia.org/wikipedia/commons/6/63/Clair_de_Lune_-_Wright_Brass_-_United_States_Air_Force_Band_of_Flight.mp3', dpath=music_dpath)

def populate_demo_media(self):
"""
Sends API calls to the server to add the demo media to the jellyfin
database.
"""
# Create a client to perform some initial configuration.
from jellyfin_apiclient_python import JellyfinClient
client = JellyfinClient()
Expand Down

0 comments on commit 720f1e5

Please sign in to comment.