Esempio n. 1
0
 def setUpClass(cls):
     cls.server = mcws.get_media_server("vqgcdx", "test", "test")
     assert cls.server.library.get_loaded()["Name"], "Test"
Esempio n. 2
0
 def setUpClass(cls):
     cls.server = mcws.get_media_server("vqgcdx", "test", "test")
     assert cls.server.library.get_loaded()["Name"], "Test"
     cls.file = cls.server.files.search("[Name]=Ukulele", "MPL")
Esempio n. 3
0
import pymcws as mcws
import time
from datetime import timedelta

# Create the server using access key and credentials
# Dont forget to replace the example access key with one of your's
# the server is resolved lazily, i.e. once the first command is sent
# office = mcws.get_media_server("AccessKey", "readonly", "supersecretpassword")

# Alternatively, just use the keyword 'localhost' if the instance runs on your machine,
# this avoids the delay of resolving the access key.
office = mcws.get_media_server("localhost", "readonly", "supersecretpassword")

# Recipes bundle commonly used tasks into simple methods
# Query files via query recipe
files = mcws.recipes.query_album(office, "Ludovico Einaudi", "I Giorni")
# files are dictionaries of tags. Tags are automatically converted to the correct python type.
# This conversion happens both ways transparently. Just use the python types, pymcws takes care of the rest
print(files[0]["Date"])
print(files[0]["Name"])
print(files[0]["Duration"])

# Editing tags is easy! Just edit the dict, and save the file afterwards
# Files keep track of the changes that are made and only send relevant data
# to the server. All data is escaped and converted automatically.
files[0]["Name"] = "Test2,3,4"
files[0]["Genre"] = ["Test Genre 3,7", "Test Genre 3,5", "Test Genre 6"]
files[0]["Date"] += timedelta(days=365)
files[0]["Rating"] = 4
# You can check which fields have been changed
print(files[0].changed_fields)