MopidyDocumentationRelease3.
1.
1-1-gf17acacfSteinMagnusJodalandcontributors2020USAGE1Installation31.
1Debian/Ubuntu31.
2ArchLinux41.
3Fedora51.
4macOS61.
5InstallfromPyPI71.
6RaspberryPi92Running112.
1Runninginaterminal112.
2Runningasaservice123Conguration173.
1Congurationlelocation173.
2Editingtheconguration173.
3Vieweffectiveconguration173.
4Coreconguration183.
5Extensionconguration213.
6Addingnewcongurationvalues214Clients234.
1Webclients234.
2MPDclients244.
3MPRISclients245Troubleshooting255.
1Gettinghelp255.
2Showeffectiveconguration255.
3Showinstalleddependencies255.
4Debuglogging265.
5Debuggingdeadlocks265.
6DebuggingGStreamer276Mopidy-File296.
1Conguration297Mopidy-M3U317.
1Editingplaylists317.
2Conguration318Mopidy-Stream33i8.
1Conguration339Mopidy-HTTP359.
1Hostingwebclients359.
2Conguration3510Mopidy-SoftwareMixer3710.
1Conguration3711Audiosinks3912Icecast4112.
1Knownissues4212.
2Fallbackstream4213UPnP4313.
1UPnPMediaRenderer4313.
2UPnPclients4414Changelog4514.
1v3.
1.
1(2020-12-26)4514.
2v3.
1.
0(2020-12-16)4514.
3v3.
0.
2(2020-04-02)4514.
4v3.
0.
1(2019-12-22)4614.
5v3.
0.
0(2019-12-22)4615History5115.
1Changelog2.
xseries5115.
2Changelog1.
xseries5815.
3Changelog0.
xseries7116Versioning10916.
1Releaseschedule10917Authors11118Sponsors11518.
1Fastly11518.
2Discourse11519Contributing11719.
1Askingquestions11719.
2Helpingusers11719.
3Issueguidelines11719.
4Pullrequestguidelines11820Developmentenvironment11920.
1Initialsetup12020.
2RunningMopidyfromGit12320.
3Runningtests12320.
4Writingdocumentation12520.
5Workingonextensions12620.
6Contributionworkow12721Extensiondevelopment12921.
1Anatomyofanextension129ii21.
2cookiecutterprojecttemplate13021.
3ExampleREADME.
rst13021.
4Examplesetup.
py13121.
5Example__init__.
py13221.
6Examplefrontend13421.
7Examplebackend13421.
8Examplecommand13421.
9Examplewebapplication13521.
10Runninganextension13521.
11Pythonconventions13521.
12UseofMopidyAPIs13521.
13Logginginextensions13521.
14MakingHTTPrequestsfromextensions13621.
15Testingextensions13722Codestyle14323Releaseprocedures14523.
1Releasingextensions14523.
2ReleasingMopidyitself14624APIreference14924.
1Concepts14924.
2Basics15924.
3Web/JavaScript18124.
4Audio18524.
5Utilities19125mopidycommand19925.
1Synopsis19925.
2Description19925.
3Options19925.
4Builtincommands20025.
5Extensioncommands20025.
6Files20025.
7Examples20025.
8Reportingbugs20126Glossary20327Indicesandtables205PythonModuleIndex207Index209iiiivMopidyDocumentation,Release3.
1.
1-1-gf17acacfMopidyisanextensiblemusicserverwritteninPython.
Mopidyplaysmusicfromlocaldisk,Spotify,SoundCloud,GooglePlayMusic,andmore.
Youedittheplaylistfromanyphone,tablet,orcomputerusingavarietyofMPDandwebclients.
StreammusicfromthecloudVanillaMopidyonlyplaysmusicfromlesandradiostreams.
Throughextensions,MopidycanplaymusicfromcloudserviceslikeSpotify,SoundCloud,andGooglePlayMusic.
WithMopidy'sextensionsupport,backendsfornewmusicsourcescanbeeasilyadded.
MopidyisjustaserverMopidyisaPythonapplicationthatrunsinaterminalorinthebackgroundonLinuxcomputersorMacsthathavenetworkconnectivityandaudiooutput.
Outofthebox,MopidyisanHTTPserver.
IfyouinstalltheMopidy-MPDextension,itbecomesanMPDservertoo.
ManyadditionalfrontendsforcontrollingMopidyareavailableasextensions.
PickyourfavoriteclientYouandthepeoplearoundyoucanallconnecttheirfavoriteMPDorwebclienttotheMopidyservertosearchformusicandmanagetheplaylisttogether.
WithabrowserorMPDclient,whichisavailableforallpopularoperatingsystems,youcancontrolthemusicfromanyphone,tablet,orcomputer.
MopidyonRaspberryPiTheRaspberryPiisanpopulardevicetorunMopidyon,eitherusingRaspbian,Ubuntu,orArchLinux.
PimoronirecommendsMopidyforusewiththeirPirateAudioaudiogearforRaspberryPi.
MopidyisalsoasignicantbuildingblockinthePiMusicboxintegratedaudiojukeboxsystemforRaspberryPi.
MopidyishackableMopidy'sextensionsupportandPython,JSON-RPC,andJavaScriptAPIsmakeMopidyaperfectbaseforyourprojects.
Inonehack,aRaspberryPiwasembeddedinanoldcassetteplayer.
ThebuttonsandvolumecontrolarewiredupwithGPIOontheRaspberryPi,andisusedtocontrolplaybackthroughacustomMopidyextension.
ThecassetteshaveNFCtagsusedtoselectplaylistsfromSpotify.
GettingstartedTogetstartedwithMopidy,beginbyreadingInstallation.
GettinghelpIfyougetstuck,youcangethelpattheourDiscourseforumorinthe#mopidy-usersstreamonZulipchat.
Ifyoustumbleintoabugorhaveafeaturerequest,pleasecreateanissueintheissuetracker.
Ifyou'reunsureifit'sabugornot,askforhelpintheforumorthechatrst.
Thesourcecodemayalsobeofhelp.
IfyouwanttostayuptodateonMopidydevelopments,youcanfollowthe#mopidy-devstreamonZulipchatorwatchoutforannouncementsontheDiscourseforum.
USAGE1MopidyDocumentation,Release3.
1.
1-1-gf17acacf2USAGECHAPTERONEINSTALLATIONThereareseveralwaystoinstallMopidy.
Whatwayisbestdependsuponyouroperatingsystemand/ordistribution:1.
1Debian/UbuntuIfyourunaDebianbasedLinuxdistribution,likeUbuntuorRaspbian,theeasiestwaytoinstallMopidyisfromtheMopidyAPTarchive.
WheninstallingfromtheAPTarchive,youwillautomaticallygetupdatestoMopidyinthesamewayasyougetupdatestotherestofyoursystem.
Ifyou'reonaRaspberryPirunningDebianorRaspbian,thefollowinginstructionswillworkforyouaswell.
Ifyou'resettingupaRaspberryPifromscratch,wehaveaguideforinstallingDebian/RaspbianandMopidy.
SeeRaspberryPi.
1.
1.
1DistributionandarchitecturesupportThepackagesintheapt.
mopidy.
comarchivearebuiltfor:Debian10(Buster),whichalsoworksforRaspbianBusterandUbuntu19.
10andnewer.
ThefewpackagesthatarecompiledareavailableformultipleCPUarchitectures:amd64i386armhf,compatiblewithallRaspberryPimodels.
Thisisjustwhatwecurrentlysupport,notapromisetocontinuetosupportthesameinthefuture.
Wewilldropsupportforolderdistributionsandarchitectureswhensupportingthosestopsusfrommovingforwardwiththeproject.
1.
1.
2Installfromapt.
mopidy.
com1.
Addthearchive'sGPGkey:wget-q-O-https://apt.
mopidy.
com/mopidy.
gpg|sudoapt-keyadd-2.
AddtheAPTrepotoyourpackagesources:sudowget-q-O/etc/apt/sources.
list.
d/mopidy.
listhttps://apt.
mopidy.
com/buster.
→list3.
InstallMopidyandalldependencies:3MopidyDocumentation,Release3.
1.
1-1-gf17acacfsudoaptupdatesudoaptinstallmopidy4.
Now,you'rereadytorunMopidy.
1.
1.
3UpgradingWhenanewreleaseofMopidyisout,andyoucan'twaitforyoursystemtogureitoutforitself,runthefollowingtoupgraderightaway:sudoaptupdatesudoaptupgrade1.
1.
4InstallingextensionsIfyouwanttouseanyMopidyextensions,likeSpotifysupportorLast.
fmscrobbling,youneedtoinstalladditionalpackages.
Tolistalltheextensionsavailablefromapt.
mopidy.
com,youcanrun:aptsearchmopidyToinstalloneofthelistedpackages,e.
g.
mopidy-mpd,simplyrun:sudoaptinstallmopidy-mpdIfyoucannotndtheextensionyouwantintheAPTsearchresult,youcaninstallitfromPyPIusingpipinstead.
EvenifMopidyitselfisinstalledfromAPTitwillcorrectlydetectanduseextensionsfromPyPIinstalledgloballyonyoursystemusing:sudopython3-mpipinstall.
.
.
ForacomprehensiveindexofavailableMopidyextensions,includingthosenotinstallablefromAPT,seetheMopidyextensionregistry.
1.
2ArchLinuxIfyouarerunningArchLinux,youcaninstallmopidyfromthe"Community"repository,aswellasmanyextensionsfromAUR.
1.
2.
1InstallfromCommunity1.
ToinstallMopidywithalldependencies,youcanuse:pacman-SmopidyToupgradeMopidytofuturereleases,justupgradeyoursystemusing:pacman-Syu2.
Now,you'rereadytorunMopidy.
4Chapter1.
InstallationMopidyDocumentation,Release3.
1.
1-1-gf17acacf1.
2.
2InstallingextensionsIfyouwanttouseanyMopidyextensions,likeSpotifysupportorLast.
fmscrobbling,AURhaspackagesformanyMopidyextensions.
Toinstalloneofthelistedpackages,e.
g.
mopidy-mpd,simplyrun:yay-Smopidy-mpdIfyoucannotndtheextensionyouwantinAUR,youcaninstallitfromPyPIusingpipinstead.
EvenifMopidyitselfisinstalledwithpacmanitwillcorrectlydetectanduseextensionsfromPyPIinstalledgloballyonyoursystemusing:sudopython3-mpipinstall.
.
.
ForacomprehensiveindexofavailableMopidyextensions,includingthosenotinstallablefromAUR,seetheMopidyextensionregistry.
1.
3FedoraIfyourunFedora30orneweryoucaninstallmopidyandmopidy-mpdfromthestandardFedorarepositories.
mopidy-spotifyisavailablefromRPMFusion.
1.
3.
1InstallMopidy1.
InstallMopidyandalldependencies:sudodnfinstallmopidyThiswillautomaticallyinstallMopidy-MPDasaweakdependencyaswell.
2.
SomeextensionsarepackagedinRPMFusion.
Toinstallthisrepository,run:sudodnfinstallhttps://download1.
rpmfusion.
org/free/fedora/rpmfusion-free-→release-$(rpm-E%fedora).
noarch.
rpmhttps://download1.
rpmfusion.
org/nonfree/→fedora/rpmfusion-nonfree-release-$(rpm-E%fedora).
noarch.
rpm3.
Now,you'rereadytorunMopidy.
1.
3.
2InstallingextensionsIfyouwanttouseanyMopidyextensions,youneedtoinstalladditionalpackages.
NotethatasofFeburary2020,onlyMopidy-MPD(automaticallyinstalled)andMopidy-Spotify(RPMFusion-nonfree)arepackaged.
Toinstallmopidy-spotifyfromRPMFusion-nonfree,simplyrun:sudodnfinstallmopidy-spotifyIfyoucannotndtheextensionyouwantintherepositories,youcaninstallitfromPyPIusingpipinstead.
EvenifMopidyitselfisinstalledfromDNFitwillcorrectlydetectanduseextensionsfromPyPIinstalledgloballyonyoursystemusing:sudopython3-mpipinstall.
.
.
1.
3.
Fedora5MopidyDocumentation,Release3.
1.
1-1-gf17acacfForacomprehensiveindexofavailableMopidyextensions,includingthosenotinstallablefromDNF,seetheMopidyextensionregistry.
1.
4macOSIfyouarerunningmacOS,youcaninstalleverythingneededwithHomebrew.
1.
4.
1InstallfromHomebrew1.
MakesureyouhaveHomebrewinstalled.
2.
MakesureyourHomebrewinstallationisuptodatebeforeyoucontinue:brewupgradeNotethatthiswillupgradeallsoftwareonyoursystemthathavebeeninstalledwithHomebrew.
3.
MopidyhasitsownHomebrewformularepo,calleda"tap".
ToenableourHomebrewtap,run:brewtapmopidy/mopidy4.
ToinstallMopidy,run:brewinstallmopidyThiswilltakesometime,asitwillalsoinstallMopidy'sdependencyGStreamer,whichagaindependsonahugenumberofmediacodecs.
5.
Now,you'rereadytorunMopidy.
1.
4.
2UpgradingWhenanewreleaseofMopidyisout,andyoucan'twaitforyousystemtogureitoutforitself,runthefollowingtoupgraderightaway:brewupgrade1.
4.
3InstallingextensionsIfyouwanttouseanyMopidyextensions,likeSpotifysupportorLast.
fmscrobbling,theHomebrewtaphasformulasforseveralMopidyextensionsaswell.
ExtensionsinstalledfromHomebrewwillcomecompletewithalldependen-cies,bothPythonandnon-Pythonones.
Tolistalltheextensionsavailablefromourtap,youcanrun:brewsearchmopidyIfyoucannotndtheextensionyouwantintheHomebrewsearchresult,youcaninstallitfromPyPIusingpipinstead.
EvenifMopidyitselfisinstalledfromHomebrewitwillcorrectlydetectanduseextensionsfromPyPIinstalledgloballyonyoursystemusing:python3-mpipinstall.
.
.
6Chapter1.
InstallationMopidyDocumentation,Release3.
1.
1-1-gf17acacfNote:Homebrewdocumentspip3install.
.
.
asthewaytoinstallpackagesfromPyPI.
Thishastheexactsameeffectaspython3-mpipinstall.
.
.
.
WekeeptothelattervarianttokeepourPyPIinstallationinstructionsidenticalacrossoperatingsystemsanddistributions.
ForacomprehensiveindexofavailableMopidyextensions,includingthosenotinstallablefromAPT,seetheMopidyextensionregistry.
1.
5InstallfromPyPIIfyouareonLinux,butcan'tinstallfromtheAPTarchiveorfromtheArchLinuxrepository,youcaninstallMopidyfromPyPIusingthepipinstaller.
IfyouarelookingtocontributeorwishtoinstallfromsourceusinggitpleaseseeContributing.
1.
Firstofall,youneedPython3.
7ornewer.
CheckifyouhavePythonandwhatversionbyrunning:python3--version2.
Youneedtomakesureyouhavepip,thePythonpackageinstaller.
You'llalsoneedaCcompilerandthePythondevelopmentheaderstoinstallsomeMopidyextensions,likeMopidy-Spotify.
ThisishowyouinstallitonDebian/Ubuntu:sudoaptinstallbuild-essentialpython3-devpython3-pipAndonArchLinuxfromtheofcialrepository:sudopacman-Sbase-develpython-pipAndonFedoraLinuxfromtheofcialrepositories:sudodnfinstall-ygccpython3-develpython3-pip3.
Thenyou'llneedtoinstallGStreamer>=1.
14.
0,withPythonbindings.
GStreamerispackagedformostpop-ularLinuxdistributions.
SearchforGStreamerinyourpackagemanager,andmakesuretoinstallthePythonbindings,andthe"good"and"ugly"pluginsets.
Debian/UbuntuIfyouuseDebian/UbuntuyoucaninstallGStreamerlikethis:sudoaptinstall\python3-gst-1.
0\gir1.
2-gstreamer-1.
0\gir1.
2-gst-plugins-base-1.
0\gstreamer1.
0-plugins-good\gstreamer1.
0-plugins-ugly\gstreamer1.
0-toolsArchLinuxIfyouuseArchLinux,installthefollowingpackagesfromtheofcialrepository:1.
5.
InstallfromPyPI7MopidyDocumentation,Release3.
1.
1-1-gf17acacfsudopacman-S\gst-python\gst-plugins-good\gst-plugins-uglyFedoraIfyouuseFedorayoucaninstallGStreamerlikethis:sudodnfinstall-y\python3-gstreamer1\gstreamer1-plugins-good\gstreamer1-plugins-ugly-freeGentooIfyouuseGentooyoucaninstallGStreamerlikethis:emerge-avgst-pythongst-plugins-metagst-plugins-metaistheonethatactuallypullsinthepluginsyouwant,sopayattentiontotheUSEags,e.
g.
alsa,mp3,etc.
macOSIfyouusemacOS,youcaninstallGStreamerfromHomebrew:brewinstall\gst-python\gst-plugins-base\gst-plugins-good\gst-plugins-ugly4.
InstallthelatestreleaseofMopidy:sudopython3-mpipinstall--upgrademopidyThiswillusepiptoinstallthelatestreleaseofMopidyfromPyPI.
ToupgradeMopidytofuturereleases,justrerunthiscommand.
5.
Now,you'rereadytorunMopidy.
1.
5.
1InstallingextensionsIfyouwanttouseanyMopidyextensions,likeSpotifysupportorLast.
fmscrobbling,youneedtoinstalladditionalMopidyextensions.
YoucaninstallanyMopidyextensiondirectlyfromPyPIwithpip.
TolistalltheextensionsavailablefromPyPI,run:python3-mpipsearchmopidyToinstalloneofthelistedpackages,e.
g.
Mopidy-MPD,simplyrun:sudopython3-mpipinstallMopidy-MPDNotethatextensionsinstalledwithpipwillonlyinstallPythondependencies.
Pleaserefertotheextension'sdocu-mentationforinformationaboutanyotherrequirementsneededfortheextensiontoworkproperly.
ForacomprehensiveindexofavailableMopidyextensions,seetheMopidyextensionregistry.
8Chapter1.
InstallationMopidyDocumentation,Release3.
1.
1-1-gf17acacf1.
6RaspberryPiMopidyrunsonallversionsofRaspberryPi.
However,notethatthelatermodelsaresignicantlymorepowerfulthantheRaspberryPi1andRaspberryPiZero;Mopidywillrunnoticablyfasteronthelatermodels.
1.
6.
1HowtoforRaspbian1.
DownloadthelatestRaspbianDesktoporLitediskimagefromhttps://www.
raspberrypi.
org/downloads/raspbian/.
UnlessyouneedafullgraphicaldesktoptheLiteimageispreferablesinceit'smuchsmaller.
2.
FlashtheRaspbianimageyoudownloadedtoyourSDcard.
SeetheRaspberryPiinstallationdocsforinstructions.
You'llneedtoenableSSHifyouarenotconnectingamonitorandakeyboard.
AsoftheNovember2016release,RaspbianhastheSSHserverdisabledbydefault.
SSHcanbeenabledbyplacingalenamed'ssh',withoutanyextension,ontothebootpartitionoftheSDcard.
Seehereformoredetails.
3.
Ifyoubootwithonlyanetworkcableconnected,you'llhavetondtheIPaddressofthePiyourself,e.
g.
bylookingintheclientlistonyourrouter/DHCPserver.
WhenyouhavefoundthePi'sIPaddress,youcanSSHtotheIPaddressandloginwiththeuserpiandpasswordraspberry.
Onceloggedin,runsudoraspi-configtostartthecongtoolastherootuser.
4.
Usetheraspi-configtooltosetupthebasicsofyourPi.
Youmightwanttodooneormoreofthefollowing:Inthetopmenu,changethepasswordofthepiuser.
Under"NetworkOptions":–N1:Setahostname.
–N2:SetupWiFicredentials,ifyou'regoingtouseWiFi.
Under"LocalisationOptions":–I1:Changelocalefromen_GB.
UTF-8toe.
g.
en_US.
UTF-8,thatis,unlessyou'reBritish.
–I2:Changethetimezone.
–I4:ChangetheWiFicountry,soyouonlyusechannelsallowedtouseinyourarea.
Under"InterfacingOptions":–P2:EnableSSH.
Under"AdvancedOptions":–A3:Adjustthememorysplit.
Ifyou'renotgoingtoconnectadisplaytoyourPi,youshouldsettheminimumvaluehereinordertomakebestuseoftheavailableRAM.
–A4:Forceaspecicaudiooutput.
Bydefault,whenusingaHDMIdisplaytheaudiowillalsobeoutputoverHDMI,otherwisethe3.
5mmjackwillbeused.
Oncedone,select"Finish".
DependingonwhatyouchangedyoumaybeaskedifyouwanttorestartyourPi,select"Yes"andthenlogbackinagainafterwards.
Ifyouwanttochangeanysettingslater,youcansimplyrerunsudoraspi-config.
5.
Ensurethesystemaudiosettingsmatchtheuseraudiosettings:sudoln-s~/.
asoundrc/etc/asound.
conf1.
6.
RaspberryPi9MopidyDocumentation,Release3.
1.
1-1-gf17acacf6.
InstallMopidyandanyMopidyextensionsyouwant,asdescribedinDebian/Ubuntu.
Note:IfyouusedtheRaspbianDesktopimageyouwillneedtoaddthemopidyusertothevideogroup:sudoaddusermopidyvideoAlso,ifyouarenotusingHDMIaudioyoumustsetMopidy'saudio/outputcongvaluetoalsasink.
Todothis,addthefollowingsnippettoyourcongle:[audio]output=alsasink1.
6.
2TestingsoundoutputYoucantestsoundoutputindependentofMopidybyrunning:aplay/usr/share/sounds/alsa/Front_Center.
wavIfyouhearavoicesaying"FrontCenter",thenyoursoundisworking.
Ifyouwanttochangeyouraudiooutputsetting,simplyrerunsudoraspi-config.
IfyouwanttocontributetothedevelopmentofMopidy,youshouldrstfollowtheinstructionsheretoinstallaregularinstallofMopidy,thencontinuewithreadingContributingandDevelopmentenvironment.
10Chapter1.
InstallationCHAPTERTWORUNNINGTherearetwoprimarywaystorunMopidy.
Whatwayisbestdependsuponyourgoalsandpreferences:2.
1RunninginaterminalFormostusers,itisprobablypreferabletorunMopidyasaservicesothatMopidyisautomaticallystartedwhenyoursystemstarts.
TheprimaryusecaseforrunningMopidymanuallyinaterminalisthatyou'redevelopingonMopidyoraMopidyextensionyourself,andareinterestedinseeingthelogoutputallthetimeandtobeabletoquicklystartandrestartMopidy.
2.
1.
1StartingTostartMopidymanually,simplyopenaterminalandrun:mopidyForacompletereferencetotheMopidycommandsandtheircommandlineoptions,seemopidycommand.
Youcanalsogetsomehelpdirectlyintheterminalbyrunning:mopidy--help2.
1.
2StoppingTostopMopidy,pressCTRL+CintheterminalwhereyoustartedMopidy.
MopidywillalsoshutdownproperlyifyousendittheTERMsignaltotheMopidyprocess,e.
g.
byusingpkillinanotherterminal:pkillmopidy11MopidyDocumentation,Release3.
1.
1-1-gf17acacf2.
1.
3CongurationWhenrunningMopidyforthersttime,it'llcreateacongurationleforyou,usuallyat~/.
config/mopidy/mopidy.
conf.
The~inthelepathautomaticallyexpandstoyourhomedirectory.
IfyourusernameisaliceandyouarerunningLinux,theconglewillprobablybeat/home/alice/.
config/mopidy/mopidy.
conf.
Asthismightvaryslightlyfromsystemtosystem,youcanchecktherstfewlinesofoutputfromMopidytoconrmtheexactlocation:INFO2019-12-2123:17:31,236[20617:MainThread]mopidy.
configLoadingconfigfrombuiltindefaultsINFO2019-12-2123:17:31,237[20617:MainThread]mopidy.
configLoadingconfigfromcommandlineoptionsINFO2019-12-2123:17:31,239[20617:MainThread]mopidy.
internal.
pathCreatingdirfile:///home/jodal/.
config/mopidyINFO2019-12-2123:17:31,240[20617:MainThread]mopidy.
configLoadingconfigfrombuiltindefaultsINFO2019-12-2123:17:31,241[20617:MainThread]mopidy.
configLoadingconfigfromcommandlineoptionsINFO2019-12-2123:17:31,249[20617:MainThread]mopidy.
internal.
pathCreatingfilefile:///home/jodal/.
config/mopidy/mopidy.
confINFO2019-12-2123:17:31,249[20617:MainThread]mopidy.
__main__Initialized/home/jodal/.
config/mopidy/mopidy.
confwithdefaultconfigToprintMopidy'seffectiveconguration,i.
e.
thecombinationofdefaults,yourcongurationle,andanycommandlineoptions,youcanrun:mopidyconfigThiswillprintyourfulleffectivecongwithpasswordsmaskedoutsothatyousafelycansharetheoutputwithothersfordebugging.
2.
2RunningasaserviceByrunningMopidyasasystemservice,usinge.
g.
systemd,itwillautomaticallybestartedwhenyoursystemstarts.
ThisisthepreferredwaytorunMopidyformostusers.
TheexactwayMopidybehaveswhenitrunsasaservicemightvarydependingonyouroperatingsystemordistribu-tion.
ThefollowingappliestoDebian,Ubuntu,Raspbian,andArchLinux.
Hopefully,otherdistributionspackagingMopidywillmakesurethisworksthesamewayontheirdistribution.
2.
2.
1CongurationWhenrunningMopidyasasystemservice,congurationisreadfrom/etc/mopidy/mopidy.
conf,andnotfrom~/.
config/mopidy/mopidy.
conf.
ToprintMopidy'seffectiveconguration,i.
e.
thecombinationofdefaults,yourcongurationle,andanycommandlineoptions,youcanrun:sudomopidyctlconfigThiswillprintyourfulleffectivecongwithpasswordsmaskedoutsothatyousafelycansharetheoutputwithothersfordebugging.
12Chapter2.
RunningMopidyDocumentation,Release3.
1.
1-1-gf17acacf2.
2.
2ServiceuserTheMopidysystemservicerunsasthemopidyuser,whichisautomaticallycreatedwhenyouinstalltheMopidypackage.
ThemopidyuserwillneedreadaccesstoanylocalmusicyouwantMopidytoplay.
Note:Ifyou'repackagingMopidyforanewdistribution,makesuretoautomaticallycreatethemopidyuserwhenthepackageisinstalled.
2.
2.
3SubcommandsTorunMopidysubcommandswiththesameuserandconglesastheserviceuses,youshouldusesudomopidyctl.
Inotherwords,wheresomeonerunningMopidymanuallyinaterminalwouldrun:mopidyYoushouldinsteadrunthefollowing:sudomopidyctlNote:Ifyou'repackagingMopidyforanewdistribution,you'llndthemopidyctlcommandintheextra/mopidyctl/directoryintheMopidyGitrepository.
2.
2.
4ServicemanagementwithsystemdOnsystemsusingsystemdyoucanenabletheMopidyservicebyrunning:sudosystemctlenablemopidyThiswillmakeMopidyautomaticallystartwhenthesystemstarts.
Mopidyisstarted,stopped,andrestartedjustlikeanyothersystemdservice:sudosystemctlstartmopidysudosystemctlstopmopidysudosystemctlrestartmopidyYoucancheckifMopidyiscurrentlyrunningasaservicebyrunning:sudosystemctlstatusmopidyYoucanusejournalctltoviewMopidy'slog,includingimportanterrormessages:sudojournalctl-umopidyjournalctlhasmanyusefuloptions,including-f/--followand-e/--pager-end,sopleasecheckoutjournalctl--helpandmanjournalctl.
2.
2.
Runningasaservice13MopidyDocumentation,Release3.
1.
1-1-gf17acacf2.
2.
5ServicemanagementonDebianOnDebiansystems(boththoseusingsystemdandnot)youcanenabletheMopidyservicebyrunning:sudodpkg-reconfiguremopidyMopidycanbestarted,stopped,andrestartedusingtheservicecommand:sudoservicemopidystartsudoservicemopidystopsudoservicemopidyrestartYoucancheckifMopidyiscurrentlyrunningasaservicebyrunning:sudoservicemopidystatus2.
2.
6ServiceonmacOSOnmacOS,youcanuselaunchctltostartMopidyautomaticallyatloginasyourownuser.
WithHomebrewIfyouinstalledMopidyfromHomebrew,simplyrunbrewinfomopidyandfollowtheinstructionsinthe"Caveats"section:$brewinfomopidy.
.
.
==>CaveatsTohavelaunchdstartmopidy/mopidy/mopidynowandrestartatlogin:brewservicesstartmopidy/mopidy/mopidyOr,ifyoudon'twant/needabackgroundservice,youcanjustrun:mopidySeebrewservices--helpforhowtostart/restart/stoptheservice.
WithoutHomebrewIfyouhappentobeonmacOS,butdidn'tinstallMopidywithHomebrew,youcangetthesameeffectbyaddingthele~/Library/LaunchAgents/mopidy.
plistwiththefollowingcontents:LabelmopidyProgramArguments/usr/local/bin/mopidyRunAtLoad(continuesonnextpage)14Chapter2.
RunningMopidyDocumentation,Release3.
1.
1-1-gf17acacf(continuedfrompreviouspage)KeepAliveYoumightneedtoadjustthepathtothemopidyexecutable,/usr/local/bin/mopidy,tomatchyoursystem.
Then,tostartMopidywithlaunchctlrightaway:launchctlload~/Library/LaunchAgents/mopidy.
plist2.
2.
7SystemserviceandPulseAudioWhenusingPulseAudio,youwilltypicallyhaveaPulseAudioserverrunbyyourmainuser.
SinceMopidyasasystemserviceisrunningasitsownuser,itcan'taccessyourPulseAudioserverdirectly.
RunningPulseAudioasasystem-widedaemonisdiscouragedbyupstream(seeherefordetails).
RatheryoucancongurePulseAudioandMopidysothatMopidysendstheaudiotothePulseAudioserveralreadyrunningasyourmainuser.
First,congurePulseAudiotoacceptsoundoverTCPfromlocalhostbyuncommentingoraddingtheTCPmoduleto/etc/pulse/default.
paor$XDG_CONFIG_HOME/pulse/default.
pa(typically~/.
config/pulse/default.
pa):###Networkaccess(maybeconfiguredwithpaprefs,soleavethiscommented###hereifyouplantousepaprefs)#load-modulemodule-esound-protocol-tcpload-modulemodule-native-protocol-tcpauth-ip-acl=127.
0.
0.
1#load-modulemodule-zeroconf-publishNext,congureMopidytousethisPulseAudioserver:[audio]output=pulsesinkserver=127.
0.
0.
1Afterthis,restartbothPulseAudioandMopidy:pulseaudio--killstart-pulseaudio-x11sudosystemctlrestartmopidyIfyouarenotrunninganyXserver,runpulseaudio--startinsteadofstart-pulseaudio-x11.
Ifyoudon'twanttohardcodetheoutputinyourMopidycong,youcaninsteadofaddinganycongtoMopidyaddthisto~mopidy/.
pulse/client.
conf:default-server=127.
0.
0.
12.
2.
Runningasaservice15MopidyDocumentation,Release3.
1.
1-1-gf17acacf16Chapter2.
RunningCHAPTERTHREECONFIGURATIONMopidyhasalotofcongvaluesyoucantweak,butyouonlyneedtochangeafewtogetupandrunning.
Acompletemopidy.
confmaybeassimpleas:[mpd]hostname=::[scrobbler]username=alicepassword=mysecret3.
1CongurationlelocationThecongurationlelocationdependsonhowyourunMopidy.
SeeeitherRunninginaterminalandRunningasaservicetondwherethecongurationleislocatedonyoursystem.
3.
2EditingthecongurationWhenyouhavecreatedthecongurationle,openitinatexteditor,andaddthecongvaluesyouwanttochange.
Ifyouwanttokeepthedefaultvalueforacongvalue,youshouldnotaddittothecongle,butleaveitoutsothatwhenwechangethedefaultvalueinafutureversion,youwon'thavetochangeyourcongurationaccordingly.
3.
3VieweffectivecongurationToseewhat'stheeffectivecongurationforyourMopidyinstallation,youcanruntheconfigsubcommand.
IfyourunMopidymanuallyinaterminal,run:mopidyconfigIfyourunMopidyasasystemservice,run:sudomopidyctlconfigThiswillprintyourfulleffectivecongwithpasswordsmaskedoutsothatyousafelycansharetheoutputwithothersfordebugging.
17MopidyDocumentation,Release3.
1.
1-1-gf17acacf3.
4CorecongurationYoucanndadescriptionofallcongvaluesbelongingtoMopidy'scorebelow.
ThisisthedefaultcongurationforMopidyitself:[core]cache_dir=$XDG_CACHE_DIR/mopidyconfig_dir=$XDG_CONFIG_DIR/mopidydata_dir=$XDG_DATA_DIR/mopidymax_tracklist_length=10000restore_state=false[logging]verbosity=0format=%(levelname)-8s%(asctime)s[%(process)d:%(threadName)s]%(name)s\n→%(message)scolor=trueconfig_file=[audio]mixer=softwaremixer_volume=output=autoaudiosinkbuffer_time=[proxy]scheme=hostname=port=username=password=3.
4.
1Coresectioncore/cache_dirPathtobasedirectoryforstoringcacheddata.
Mopidyandextensionswillusethispathtocachedatathatcansafelybethrownaway.
IfyoursystemisrunningfromanSDcard,itcanhelpavoidwearandcorruptionofyourSDcardbypointingthiscongtoanotherlocation.
IfyouhaveenoughRAM,atmpfsmightbeagoodchoice.
WhenrunningMopidyasaregularuser,thisshouldusuallybe$XDG_CACHE_DIR/mopidy,i.
e.
~/.
cache/mopidy.
WhenrunningMopidyasasystemservice,thisshouldusuallybe/var/cache/mopidy.
core/config_dirPathtobasedirectoryforcongles.
WhenrunningMopidyasaregularuser,thisshouldusuallybe$XDG_CONFIG_DIR/mopidy,i.
e.
~/.
config/mopidy.
WhenrunningMopidyasasystemservice,thisshouldusuallybe/etc/mopidy.
core/data_dirPathtobasedirectoryforpersistentdatales.
18Chapter3.
CongurationMopidyDocumentation,Release3.
1.
1-1-gf17acacfMopidyandextensionswillusethispathtostoredatathatcannotbebethrownawayandreproducedwithoutsomeeffort.
ExamplesincludeMopidy-Local'sindexofyourmedialibraryandMopidy-M3U'sstoredplaylists.
WhenrunningMopidyasaregularuser,thisshouldusuallybe$XDG_DATA_DIR/mopidy,i.
e.
~/.
local/share/mopidy.
WhenrunningMopidyasasystemservice,thisshouldusuallybe/var/lib/mopidy.
core/max_tracklist_lengthMaxlengthofthetracklist.
Defaultsto10000.
TheoriginalMPDserveronlysupports10000tracksinthetracklist.
SomeMPDclientswillcrashifthislimitisexceeded.
core/restore_stateWhensettotrue,Mopidyrestoresitslaststatewhenstarted.
Therestoredstateincludesthetracklist,playbackhistory,theplaybackstate,thevolume,andmutestate.
Defaultisfalse.
3.
4.
2AudiosectionThesearetheavailableaudiocongurations.
Forspecicusecases,seeAudiosinks.
audio/mixerAudiomixertouse.
Thedefaultissoftware,whichdoesvolumecontrolinsideMopidybeforetheaudioissenttotheaudiooutput.
Thismixerdoesnotaffectthevolumeofanyotheraudioplaybackonthesystem.
Itistheonlymixerthatwillaffecttheaudiovolumeifyou'restreamingtheaudiofromMopidythroughShoutcast.
Ifyouwanttodisableaudiomixingsetthevaluetonone.
Ifyouwanttouseahardwaremixer,youneedtoinstallaMopidyextensionwhichintegrateswithyoursoundsubsystem.
E.
g.
forALSA,installMopidy-ALSAMixer.
audio/mixer_volumeInitialvolumefortheaudiomixer.
Expectsanintegerbetween0and100.
Settingthecongvaluetoblankleavestheaudiomixervolumeunchanged.
Forthesoftwaremixerblankmeans100.
audio/outputAudiooutputtouse.
ExpectsaGStreamersink.
Typicalvaluesareautoaudiosink,alsasink,osssink,oss4sink,pulsesink,andshout2send,andadditionalargumentsspecictoeachsink.
Youcanusethecommandgst-inspect-1.
0toseewhatoutputpropertiescanbesetonthesink.
Forexample:gst-inspect-1.
0shout2sendaudio/buffer_timeBuffersizeinmilliseconds.
Expectsanintegerabove0.
SetsthebuffersizeoftheGStreamerqueue.
Ifyouexperiencebufferingbeforetrackchanges,itmayhelptoincreasethis,possiblybyatleastafewseconds.
ThedefaultislettingGStreamerdecidethesize,whichatthetimeofthiswritingis1000.
3.
4.
Coreconguration19MopidyDocumentation,Release3.
1.
1-1-gf17acacf3.
4.
3Loggingsectionlogging/verbosityControlsthedetaillevelofthelogging.
Rangesfrom-1to4.
Defaultsto0.
Highervalueismoreverbose.
-1isequivalenttomopidy-q.
0isequivalenttomopidy.
1isequivalenttomopidy-v.
2isequivalenttomopidy-vv.
3isequivalenttomopidy-vvv.
4isequivalenttomopidy-vvvv.
logging/colorWhetherornottocolorizetheconsolelogbasedonloglevel.
Defaultstotrue.
logging/formatThemessageformatusedforlogging.
SeethePythonloggingdocsfordetailsontheformat.
logging/config_fileConglethatoverridesallloggingcongvalues,seethePythonloggingdocsfordetails.
loglevels/*TheloglevelscongsectioncanbeusedtochangetheloglevelforspecicpartsofMopidyduringdevel-opmentordebugging.
Eachkeyinthecongsectionshouldmatchthenameofalogger.
Thevalueisthelogleveltouseforthatlogger,oneoftrace,debug,info,warning,error,orcritical.
logcolors/*ThelogcolorscongsectioncanbeusedtochangethelogcolorforspecicpartsofMopidyduringdevel-opmentordebugging.
Eachkeyinthecongsectionshouldmatchthenameofalogger.
Thevalueisthecolortouseforthatlogger,oneofblack,red,green,yellow,blue,magenta,cyanorwhite.
3.
4.
4ProxysectionNotallpartsofMopidyorallMopidyextensionsrespecttheproxyservercongurationwhenconnectingtotheInternet.
Currently,thisisatleastusedwhenMopidy'saudiosubsystemreadsmediadirectlyfromthenetwork,likewhenlisteningtoInternetradiostreams,andbytheMopidy-Spotifyextension.
Withtime,wehopethatmoreoftheMopidyecosystemwillrespectthesecongurationstohelpusersonlockeddownnetworks.
proxy/schemeURIschemefortheproxyserver.
Typicallyhttp,https,socks4,orsocks5.
proxy/hostnameHostnameoftheproxyserver.
proxy/portPortnumberoftheproxyserver.
proxy/usernameUsernamefortheproxyserver,ifneeded.
proxy/passwordPasswordfortheproxyserver,ifneeded.
20Chapter3.
CongurationMopidyDocumentation,Release3.
1.
1-1-gf17acacf3.
5ExtensioncongurationEachinstalledMopidyextensionaddsitsowncongurationsectiontomopidy.
conf,withoneormorecongvaluesthatyoumaywanttotweak.
Foranoverviewoftheavailablecongvalues,pleaserefertothedocumentationforeachextension.
MostextensionscanbefoundintheMopidyextensionregistry.
Mopidyextensionsareenabledbydefaultwhentheyareinstalled.
Ifyouwanttodisableanextensionwithoutunin-stallingit,allextensionssupporttheenabledcongvalueevenifitisn'texplicitlydocumentedbyallextensions.
Iftheenabledcongvalueissettofalsetheextensionwillnotbestarted.
Forexample,todisabletheMPDextension,addthefollowingtoyourmopidy.
conf:[mpd]enabled=false3.
6AddingnewcongurationvaluesMopidy'scongvalidatorwillvalidateallofitsowncongsectionsandthecongsectionsbelongingtoanyinstalledextension.
ItwillraiseanerrorifyouaddanycongvaluesinyourconglethatMopidydoesn'tknowabout.
Thismaysoundobnoxious,butithelpsusdetecttyposinyourcong,andtowarnaboutdeprecatedcongvaluesthatshouldberemovedorupdated.
Ifyou'reextendingMopidy,andwanttouseMopidy'scongurationsystem,youcanaddnewsectionstothecongwithouttriggeringthecongvalidator.
WerecommendthatyouchooseagoodanduniquenameforthecongsectionsothatmultipleextensionstoMopidycanbeusedatthesametimewithoutanydangerofnamingcollisions.
3.
5.
Extensionconguration21MopidyDocumentation,Release3.
1.
1-1-gf17acacf22Chapter3.
CongurationCHAPTERFOURCLIENTSOnceMopidyisupandrunning,youneedaclienttocontrolit.
NotethatclientsonlycontrolMopidy.
Theaudioitselfisnotstreamedtotheclients,butitisplayedonthecomputerrunningMopidy.
Thisisbydesign,asMopidywasoriginallymodelledafterMPD.
IfyouwanttostreamaudiofromMopidytoanotherdevice,theprimaryoptionsareIcecastandSnapcast.
ThemostpopularwaystocontrolMopidyarewithwebclientsandwithMPDclients.
Inaddition,alternativefrontendslikeMopidy-MPRISandMopidy-Raspberry-GPIOprovidesadditionalwaystocon-trolMopidy.
Alternativefrontendsthatuseaserver-clientarchitectureusuallylistrelevantclientsintheextension'sdocumentation.
4.
1WebclientsTherearemanyclientsavailablethatuseMopidy-HTTPtocontrolMopidy.
4.
1.
1WebextensionsMopidyextensionscanmakeadditionalwebAPIsavailablethroughMopidy'sbuiltinwebserverbyimplementingtheHTTPserversideAPI.
WebclientscanusetheHTTPJSON-RPCAPItocontrolMopidyfromJavaScript.
SeetheMopidyextensionregistrytondanumberofwebclientscanbeeasilyinstalledasMopidyextensions.
4.
1.
2Non-extensionwebclientsThereareafewMopidywebclientsthatarenotinstallableasMopidyextensions:ApolloPlayerMopster23MopidyDocumentation,Release3.
1.
1-1-gf17acacf4.
1.
3Web-basedMPDclientsLastly,thereareseveralwebbasedMPDclients,whichdoesn'tusetheMopidy-HTTPfrontendatall,butconnecttoMopidythroughtheMopidy-MPDfrontend.
Foralistofthose,seethe"Webclients"sectionoftheMPDwiki'sclientslist.
4.
2MPDclientsMPDistheprotocolusedbytheoriginalMPDserverprojectsince2003.
TheMopidy-MPDextensionprovidesaserverthatimplementsthesameprotocol,andiscompatiblewithmostMPDclients.
TherearedozensofMPDclientsavailable.
PleaserefertotheMopidy-MPDextension'sdocumentationforanoverview.
4.
3MPRISclientsMPRISisaspecicationthatdescribesastandardD-Businterfaceformakingmediaplayersavailabletootherappli-cationsonthesamesystem.
SeetheMopidy-MPRISdocumentationforasurveyofsomeMPRISclients.
24Chapter4.
ClientsCHAPTERFIVETROUBLESHOOTINGWhenyou'redebuggingyourselforaskingforhelp,therearesometoolsbuiltintoMopidythatyoushouldknowabout.
5.
1GettinghelpIfyougetstuck,youcangethelpattheourDiscourseforumorinthe#mopidy-usersstreamonZulipchat.
Ifyoustumbleintoabugorhaveafeaturerequest,pleasecreateanissueintheissuetracker.
Ifyou'reunsureifit'sabugornot,askforhelpintheforumorthechatrst.
Thesourcecodemayalsobeofhelp.
5.
2ShoweffectivecongurationTheconfigsubcommandwillprintyourfulleffectivecongurationthewayMopidyseesitafteralldefaultsandallcongleshavebeenmergedintoasinglecongdocument.
Anysecretvalueslikepasswordsaremaskedout,sotheoutputofthecommandshouldbesafetosharewithothersfordebugging.
IfyourunMopidymanuallyinaterminal,run:mopidyconfigIfyourunMopidyasasystemservice,run:sudomopidyctlconfig5.
3ShowinstalleddependenciesThedepssubcommandwilllistthepathstoandversionsofanydependencyMopidyortheextensionsmightneedtowork.
Thisisveryusefuldataforcheckingthatyou'reusingtherightversions,andthatyou'reusingtherightinstallationifyouhavemultipleinstallationsofadependencyonyoursystem.
IfyourunMopidymanuallyinaterminal,run:mopidydepsIfyourunMopidyasasystemservice,run:sudomopidyctldeps25MopidyDocumentation,Release3.
1.
1-1-gf17acacf5.
4DebugloggingIfyourunmopidy-vormopidy-vv,mopidy-vvv,ormopidy-vvvvMopidywillprintmoreandmoredebuglogtostderr.
AllfouroptionswillgiveyoudebugleveloutputfromMopidyandextensions,while-vv,-vvv,and-vvvvwillgiveyoumorelogoutputfromtheirdependenciesaswell.
Tosaveadebuglogtoleforsharingwithothers,youcanpipestdoutandstderrtoale:mopidy-vvvv2>&1|teemopidy.
logIfyourunMopidyasasystemservice,addingargumentsonthecommandlinemightbecomplicated.
Asanalternative,youcansetthecongurationlogging/verbosityto4insteadofpassing-vvvvonthecommandline:[logging]verbosity=4IfyourunMopidyasasystemserviceandareusingjournald,likemostmodernLinuxsystems,youcanviewtheMopidylogbyrunning:sudojournalctl-umopidyTosavetheoutputtoaleforsharing,run:sudojournalctl-umopidy|teemopidy.
logIfyouwanttoreducetheloggingforsomecomponent,seethedocsfortheloglevels/*congsection.
Forexample,toonlygeterrorlogmessagesfromrequests,evenwhenrunningwithmaximumverbosity,youcanaddthefollowingtomopidy.
conf:[loglevels]requests=error5.
5DebuggingdeadlocksIfMopidyhangswithoutanobviousexplanation,youcansendtheSIGUSR1signaltotheMopidyprocess.
IfMopidy'smainthreadisstillresponsive,itwilllogatracebackforeachrunningthread,showingwhatthethreadsarecurrentlydoing.
Thisisaveryusefultoolforunderstandingexactlyhowthesystemisdeadlocking.
Ifyouhavethepkillcommandinstalled,youcanusethisbysimplyrunning:pkill-SIGUSR1mopidyYoucanreadmoreaboutthedeadlockdebughelperinthePykkadocumentation.
26Chapter5.
TroubleshootingMopidyDocumentation,Release3.
1.
1-1-gf17acacf5.
6DebuggingGStreamerIfyoureallywanttodiginanddebugGStreamerbehaviour,thencheckouttheDebuggingsectionofGStreamer'sdocumentationforyouroptions.
NotethatMopidydoesnotsupporttheGStreamercommandlineoptions,like--gst-debug-level=3,butsettingGStreamerenvironmentvariables,likeGST_DEBUG,workswithMopidy.
Forexample,torunMopidywithdebugloggingandGStreamerloggingatlevel3,youcanrun:GST_DEBUG=3mopidy-vThiswillproducealotofoutput,butgivensomeGStreamerknowledgethisisveryusefulfordebuggingGStreamerpipelineissues.
AdditionallyGST_DEBUG_FILE=gstreamer.
logcanbeusedtoredirectthedebugloggingtoaleinsteadofstdout.
LastlyGST_DEBUG_DUMP_DOT_DIRcanbeusedtogetdescriptionsofthecurrentpipelineindotformat.
Currentlywetriggeradumpofthepipelineoneverycompletedstatechange:GST_DEBUG_DUMP_DOT_DIR=.
mopidy5.
6.
DebuggingGStreamer27MopidyDocumentation,Release3.
1.
1-1-gf17acacf28Chapter5.
TroubleshootingCHAPTERSIXMOPIDY-FILEMopidy-Fileisanextensionforplayingmusicfromyourlocalmusicarchive.
ItisbundledwithMopidyandenabledbydefault.
Itallowsyoutobrowsethroughyourlocallesystem.
Onlylesthatareconsideredplayablewillbeshown.
ThisbackendhandlesURIsstartingwithfile:.
Thisbackenddoesnotcurrentlyprovideimages.
6.
1CongurationSeeCongurationforgeneralhelponconguringMopidy.
[file]enabled=truemedia_dirs=$XDG_MUSIC_DIR|Music~/|Homeshow_dotfiles=falseexcluded_file_extensions=.
directory.
html.
jpeg.
jpg.
log.
nfo.
pdf.
png.
txt.
zipfollow_symlinks=falsemetadata_timeout=1000file/enabledIftheleextensionshouldbeenabledornot.
file/media_dirsAlistofdirectoriestobebrowsable.
Optionallythepathcanbefollowedby|andanamethatwillbeshownforthatpath.
file/show_dotfilesWhethertoshowhiddenlesanddirectoriesthatstartwithadot.
Defaultisfalse.
29MopidyDocumentation,Release3.
1.
1-1-gf17acacffile/excluded_file_extensionsFileextensionstoexcludewhenscanningthemediadirectory.
Valuesshouldbeseparatedbyeithercommaornewline.
file/follow_symlinksWhethertofollowsymboliclinksfoundinfile/media_dirs.
Directoriesandlesthatareoutsidethecongureddirectorieswillnotbeshown.
Defaultisfalse.
file/metadata_timeoutNumberofmillisecondsbeforegivingupscanningaleandmovingontothenextle.
Reducingthevaluemightspeedupthedirectorylisting,butcanleadtosometracksnotbeingshown.
30Chapter6.
Mopidy-FileCHAPTERSEVENMOPIDY-M3UMopidy-M3UisanextensionforreadingandwritingM3Uplaylistsstoredondisk.
ItisbundledwithMopidyandenabledbydefault.
ThisbackendhandlesURIsstartingwithm3u:.
7.
1EditingplaylistsThereisacoreplaylistAPIinplaceforeditingplaylists.
ThisissupportedbyafewMopidyclients,butnotthroughMopidy'sMPDserveryet.
ItispossibletoeditplaylistsbyeditingtheM3Uleslocatedinthem3u/playlists_dirdirectorybyhandwithatexteditor.
SeeWikipediaforashortdescriptionofthequitesimpleM3Uplaylistformat.
IfyourunMopidymanuallyinaterminal,theplaylistsareusuallyfoundin~/.
local/share/mopidy/m3u/.
IfyourunMopidyasasystemservice,theplaylistsareusuallyfoundin/var/lib/mopidy/m3u/.
7.
2CongurationSeeCongurationforgeneralhelponconguringMopidy.
[m3u]enabled=trueplaylists_dir=base_dir=$XDG_MUSIC_DIRdefault_encoding=latin-1default_extension=.
m3u8m3u/enabledIftheM3Uextensionshouldbeenabledornot.
m3u/playlists_dirPathtodirectorywithM3Ules.
Unsetbydefault,inwhichcasetheextension'sdatadirisusedtostoreplaylists.
m3u/base_dirPathtobasedirectoryforresolvingrelativepathsinM3Ules.
Ifnotset,relativepathsareresolvedbasedontheM3Ule'slocation.
m3u/default_encodingTextencodingusedforleswithextension.
m3u.
Defaultislatin-1.
Notethatleswithextension.
m3u8arealwaysexpectedtobeUTF-8encoded.
31MopidyDocumentation,Release3.
1.
1-1-gf17acacfm3u/default_extensionTheleextensionforM3UplaylistscreatedusingthecoreplaylistAPI.
Defaultis.
m3u8.
32Chapter7.
Mopidy-M3UCHAPTEREIGHTMOPIDY-STREAMMopidy-Streamisanextensionforplayingstreamingmusic.
ItisbundledwithMopidyandenabledbydefault.
Thisbackenddoesnotprovidealibraryorplayliststorage.
ItsimplyacceptsanyURIaddedtoMopidy'stracklistthatmatchesanyoftheprotocolsinthestream/protocolscongvalue.
ItthentriestoretrievemetadataandplaybacktheURIusingGStreamer.
Forexample,ifyou'reusinganMPDclient,you'lljusthavetondyourclients"addURI"interface,andprovideitwiththeURIofastream.
Inadditiontoplayingstreams,theextensionalsounderstandshowtoextractstreamsfromalotofplaylistformats.
ThisisconvenientasmostInternetradiostationslinkstoplaylistsinsteadofdirectlytotheradiostreams.
Ifyou'rehavingtroubleplayingbackastream,seeShowinstalleddependenciesforhowtocheckifyouhaveallrelevantGStreamerpluginsinstalled.
8.
1CongurationSeeCongurationforgeneralhelponconguringMopidy.
[stream]enabled=trueprotocols=httphttpsmmsrtmprtmpsrtsptimeout=5000metadata_blacklist=stream/enabledIfthestreamextensionshouldbeenabledornot.
stream/protocolsWhitelistofURIschemastoallowstreamingfrom.
Valuesshouldbeseparatedbyeithercommaornewline.
stream/timeoutNumberofmillisecondsbeforegivinguplookingupstreammetadata.
stream/metadata_blacklistListofURIglobstonotfetchmetadatafrombeforeplaying.
ThisfeatureistypicallyneededforplayonceURIsprovidedbycertainstreamingproviders.
RegularPOSIXglobsemanticsapply,sohttp://*.
example.
com/*wouldmatchallexample.
comsub-domains.
33MopidyDocumentation,Release3.
1.
1-1-gf17acacf34Chapter8.
Mopidy-StreamCHAPTERNINEMOPIDY-HTTPMopidy-HTTPisanextensionthatletsyoucontrolMopidythroughHTTPandWebSockets,forexamplefromawebclient.
ItisbundledwithMopidyandenabledbydefault.
Whenitisenableditstartsawebserverattheportspeciedbythehttp/portcongvalue.
Warning:Asasimplesecuritymeasure,thewebserverisbydefaultonlyavailablefromlocalhost.
Tomakeitavailablefromothercomputers,changethehttp/hostnamecongvalue.
Beforeyoudoso,notethattheHTTPextensiondoesnotfeatureanyformofuserauthenticationorauthorization.
AnyoneabletoaccessthewebservercanusethefullcoreAPIofMopidy.
Thus,youprobablyonlywanttomakethewebserveravailablefromyourlocalnetworkorplaceitbehindawebproxywhichtakescareofuserauthentication.
Youhavebeenwarned.
9.
1HostingwebclientsMopidy-HTTP'swebservercanalsohostTornadoappsoranystaticles,forexampletheHTML,CSS,JavaScript,andimagesneededforawebbasedMopidyclient.
SeeHTTPserversideAPIforhowtomakestaticlesorserver-sidefunctionalityfromaMopidyextensionavailablethroughMopidy'swebserver.
Ifyou'remakingawebbasedclientandwanttodoserversidedevelopmentusingsomeothertechnologythanTornado,youareofcoursefreetorunyourownwebserverandjustuseMopidy'swebservertohosttheAPIendpoints.
But,forclientsimplementedpurelyinJavaScript,lettingMopidyhostthelesisasimplersolution.
SeeHTTPJSON-RPCAPIfordetailsonhowtointegratewithMopidyoverHTTP.
Ifyou'relookingforawebbasedclientforMopidy,gocheckoutWebclients.
9.
2CongurationSeeCongurationforgeneralhelponconguringMopidy.
[http]enabled=truehostname=127.
0.
0.
1port=6680zeroconf=MopidyHTTPserveron$hostnameallowed_origins=csrf_protection=truedefault_app=mopidyhttp/enabledIftheHTTPextensionshouldbeenabledornot.
35MopidyDocumentation,Release3.
1.
1-1-gf17acacfhttp/hostnameWhichaddresstheHTTPservershouldbindto.
127.
0.
0.
1ListensonlyontheIPv4loopbackinterface::1ListensonlyontheIPv6loopbackinterface0.
0.
0.
0ListensonallIPv4interfaces::Listensonallinterfaces,bothIPv4andIPv6http/portWhichTCPporttheHTTPservershouldlistento.
http/zeroconfNameoftheHTTPservicewhenpublishedthroughZeroconf.
Thevariables$hostnameand$portcanbeusedinthename.
Ifset,theZeroconfservices_http.
_tcpand_mopidy-http.
_tcpwillbepublished.
SettoanemptystringtodisableZeroconfforHTTP.
http/allowed_originsAlistofdomainsallowedtoperformCross-OriginResourceSharing(CORS)requests.
ThisappliestobothJSON-RPCandWebSocketrequests.
Valuesshouldbeintheformathostname:port,shouldnotspecifyanyschemeandbeseparatedbyeitheracommaornewline.
Additionally,theportshouldnotbespeciedifitisthedefault(80forhttp,443forhttps).
Same-originrequests(i.
e.
requestsfromMopidy'swebserver)arealwaysallowedandsoyoudon'tneedanentryforthose.
However,ifyourrequestsoriginatefromadifferentwebserver,youwillneedtoaddanentryforthatserverinthislist.
Forexample,toallowrequestsfromawebserverat'http://my-web-client.
example.
com'youwouldspecifytheentry'my-web-client.
example.
com'.
http/csrf_protectionEnabletheHTTPserver'sprotectionagainstCross-SiteRequestForgery(CSRF)frombothJSON-RPCandWebSocketrequests.
DisablingthiswillremovetherequirementtosetaContent-Type:application/jsonheaderforJSON-RPCPOSTrequests.
Itwillalsodisableallsame-originchecks,effectivelyignoringthehttp/allowed_originscongsincerequestsfromanyoriginwillbeallowed.
Lastly,allAccess-Control-Allow-*responseheaderswillbesuppressed.
ThiscongshouldonlybedisabledifyouunderstandthesecurityimplicationsandrequiretheHTTPserver'soldbehaviour.
http/default_appRedirectfromthewebserverroottoaspecicwebappinsteadofMopidy'sdefaultlistofwebapps.
Thevalueshouldbethenameusedbytheextensionwhenitregistersitshttp:staticorhttp:appextensionpoints.
Byconvention,thisisthetheextension'sext_name.
36Chapter9.
Mopidy-HTTPCHAPTERTENMOPIDY-SOFTWAREMIXERMopidy-SoftwareMixerisanextensionforcontrollingaudiovolumeinsoftwarethroughGStreamer.
ItistheonlymixerbundledwithMopidyandisenabledbydefault.
IfyouusePulseAudio,thesoftwaremixerwillcontroltheper-applicationvolumeforMopidyinPulseAudio,andanychangestotheper-applicationvolumedonefromoutsideMopidywillbereectedbythesoftwaremixer.
Ifyoudon'tusePulseAudio,themixerwilladjustthevolumeinternallyinMopidy'sGStreamerpipeline.
10.
1CongurationMultiplemixerscanbeinstalledandenabledatthesametime,butonlythemixerpointedtobytheaudio/mixercongvaluewillactuallybeused.
SeeCongurationforgeneralhelponconguringMopidy.
[softwaremixer]enabled=truesoftwaremixer/enabledIfthesoftwaremixershouldbeenabledornot.
Usuallyyoudon'twanttochangethis,butinsteadchangetheaudio/mixercongvaluetodecidewhichmixerisactuallyused.
37MopidyDocumentation,Release3.
1.
1-1-gf17acacf38Chapter10.
Mopidy-SoftwareMixerCHAPTERELEVENAUDIOSINKSMopidyhasveryfewaudiocongurations,buttheoneswehaveareverypowerfulbecausetheyletyoumodifytheGStreameraudiopipelinedirectly.
IfyouhavesuccessfullyinstalledGStreamer,andthenrunthegst-inspect-1.
0command,youshouldseealonglistingofinstalledplugins,endinginasummaryline:$gst-inspect-1.
0.
.
.
longlistofinstalledplugins.
.
.
Totalcount:233plugins,1339featuresNext,youshouldbeabletoproduceaaudibletonebyrunning:gst-launch-1.
0audiotestsrc!
audioresample!
autoaudiosinkIfyoucannothearanysoundwhenrunningthiscommand,youwon'thearanysoundfromMopidyeither,asMopidybydefaultusesGStreamer'sautoaudiosinktoplayaudio.
Thus,makethisworkbeforeyouleabugagainstMopidy.
IfyouforsomereasonwanttousesomeotherGStreameraudiosinkthanautoaudiosink,youcansettheaudio/outputcongvaluetoapartialGStreamerpipelinedescriptiondescribingtheGStreamersinkyouwanttouse.
Examplemopidy.
confforusingOSS4:[audio]output=oss4sinkAgain,thisistheequivalentofthefollowinggst-launch-1.
0command,somakethisworkrst:gst-launch-1.
0audiotestsrc!
audioresample!
oss4sink39MopidyDocumentation,Release3.
1.
1-1-gf17acacf40Chapter11.
AudiosinksCHAPTERTWELVEICECASTIfyouwanttoplaytheaudioonanothercomputerthantheonerunningMopidy,youcanstreamtheaudiofromMopidythroughanIcecastaudiostreamingserver.
Multiplemediaplayerscanthenbeconnectedtothestreamingserversimultaneously.
TousetheIcecastoutput,dothefollowing:Warning:Thelastknownworkingversionoflibshout3isv2.
4.
1,thisistheversionavailableinDebianBuster.
Newerversionsofthislibrary,suchasthosefoundinUbuntu20.
04andDebianBullseyearebuggedandrenderGStreamer'sshout2sendsinkbrokenandunusable.
YoucannotstreamfromMopidyviaIcecastwiththebelowmethodwhenusingUbuntu20.
04orDebianBullseye.
ConsiderSnapcastasanalternativesolution.
1.
Install,congureandstarttheIcecastserver.
Itcanbefoundintheicecast2packageinDebian/Ubuntu.
2.
Settheaudio/outputcongvaluetoencodetheoutputaudiotoMP3(lamemp3enc)orOggVorbis(audioresample!
audioconvert!
vorbisenc!
oggmux)andsendittoIcecast(shout2send).
Youmightalsoneedtochangetheshout2senddefaultsettings,rungst-inspect-1.
0shout2sendtoseetheavailablesettings.
Mostlikelyyouwanttochangeip,username,password,andmount.
ExampleforMP3streaming:[audio]output=lamemp3enc!
shout2sendasync=falsemount=mopidyip=127.
0.
0.
1port=8000→password=hackmeExampleforOggVorbisstreaming:[audio]output=audioresample!
audioconvert!
vorbisenc!
oggmux!
shout2send→async=falsemount=mopidyip=127.
0.
0.
1port=8000password=hackmeExampleforMP3streamingandlocalaudio(multipleoutputs):[audio]output=teename=t!
queue!
audioresample!
autoaudiosinkt.
!
queue!
→lamemp3enc!
shout2sendasync=falsemount=mopidyip=127.
0.
0.
1port=8000→password=hackmeOtheradvancedsetupsarealsopossibleforoutputs.
Basically,anythingyoucanusewiththegst-launch-1.
0commandcanbepluggedintoaudio/output.
41MopidyDocumentation,Release3.
1.
1-1-gf17acacf12.
1KnownissuesChangingtrack:AsofMopidy1.
2wesupportgaplessplayback,andthestreamdoesnolongerendwhenchangingfromonetracktoanother.
Previous/next:Thestreamendsonpreviousandnext.
See#1306fordetails.
Thiscanbeworkedaroundusingafallbackstream,asdescribedbelow.
Pause:Pausingplaybackstopsthestream.
Thisisprobablynotsomethingwe'regoingtox.
Thiscanbeworkedaroundusingafallbackstream,asdescribedbelow.
Metadata:Trackmetadatamightbemissingfromthestream.
ForSpotify,thisshouldmostlyworkasofMopidy2.
0.
1.
Forotherextensions,#866isthetrackingissue.
12.
2FallbackstreamByusingafallbackstreamplayingsilence,youcansomewhatmitigatetheknownissuesabove.
ExampleIcecastconguration:/mopidy/silence.
mp31YoucaneasilyndMP3leswithjustsilencebysearchingtheweb.
Thesilence.
mp3leneedstobeplacedinthedirectorydenedby.
.
.
intheIcecastconguration.
42Chapter12.
IcecastCHAPTERTHIRTEENUPNPUPnPisasetofspecicationsformediasharing,playing,remotecontrol,etc,acrossahomenetwork.
Thespecsaresupportedbyalotofconsumerdevices(likesmartphones,TVs,Xbox,andPlayStation)thatareoftenlabeledasbeingDLNAcompatibleorcertied.
13.
1UPnPMediaRendererTheDLNAguidelinesandUPnPspecicationsdenesseveraldeviceroles,ofwhichMopidymayplaytheroleofDLNADigitalMediaRenderer(DMR),alsoknownasanUPnPMediaRenderer.
AMediaRendererisaskedbysomeremotecontrollertoplaysomegivenmedia,typicallyservedbyaMediaServer.
IfMopidywasaMediaRenderer,youcouldusee.
g.
yoursmartphoneortablettomakeMopidyplaymedia.
TherearetwowaysMopidycanbemadeavailableasanUPnPMediaRenderer:usingMopidy-MPDandupmpdcli,orusingMopidy-MPRISandRygel.
13.
1.
1Mopidy-MPDandupmpdcliupmpdcliisrecommended,sinceitiseasiertosetup,andoffersOpenHomecompatibility.
upmpdcliexposesaUPnPMediaRenderertothenetwork,whileusingtheMPDprotocoltocontrolMopidy.
1.
Installupmpdcli.
OnDebian/Ubuntu:sudoaptinstallupmpdcliAlternatively,followtheinstructionsfromtheupmpdcliwebsite.
2.
ThedefaultsettingsofupmpdcliwillworkwiththedefaultsettingsofMopidy-MPD.
Edit/etc/upmpdcli.
confifyouwanttousedifferentports,hosts,orothersettings.
3.
Startupmpdcliusingthecommand:upmpdcliOr,runitinthebackgroundasaservice:sudoserviceupmpdclistart4.
AnUPnPrenderershouldbeavailablenow.
43MopidyDocumentation,Release3.
1.
1-1-gf17acacf13.
1.
2Mopidy-MPRISandRygelSeetheMopidy-MPRISdocumentationforhowtosetupRygeltomakeMopidyanUPnPMediaRenderer.
13.
2UPnPclientsForalonglistofUPnPclientsforallpossibleplatforms,seeWikipedia'sListofUPnPAVmediaserversandclients.
44Chapter13.
UPnPCHAPTERFOURTEENCHANGELOGThischangelogisusedtotrackallmajorchangestoMopidy.
Forolderreleases,seeHistory.
14.
1v3.
1.
1(2020-12-26)Fixcrashwhenextractingtagsusinggst-python>=1.
18.
(PR:#1948)14.
2v3.
1.
0(2020-12-16)AddPython3.
9toourtestmatrix.
Addmopidy.
backend.
PlaybackProvider.
should_download()whichcanbeimplementedbyplaybackprovidersthatwanttouseGStreamer'sdownloadbufferingstrategyfortheirURIs.
(PR:#1888)Audio:FixmemoryleakwhenconvertingGStreamersampletypetags.
(Fixes:#1827,PR:#1929)Turnoffstrictparsingof*.
plsplaylistles.
ThiswasaregressionthathappenedduringthemigrationtoPython3.
(PR:#1923)MakethesystemdunitthatshipswithMopidywaitforanInternetconnectionbeforestartingMopidy.
Whenusedbydistributionpackages,thiscanhelpavoidthatextensionstrytoconnecttocloudservicesbeforethemachine'sInternetconnectionisreadyforuse.
(PR:#1946)14.
3v3.
0.
2(2020-04-02)Bugxrelease.
Core:Resetstreamtitleonreceiptofanytitleaudiotagchange.
(Fixes:#1871,PR:#1875)Core:Hidethemethodsmopidy.
core.
Core.
setup()andmopidy.
core.
Core.
teardown()fromotheractorsandJSON-RPCAPIclients.
Themethodshavealwaysbeenclearlydocumentedasinternal.
(PR:#1865)Cong:Logawarningifunknowncongsectionsarefound.
(Fixes:#1878,PR:#1890)Cong:Fixcrashwhenreadingvaluesfromkeyring.
(PR:#1887)Variousdocumentationupdates.
45MopidyDocumentation,Release3.
1.
1-1-gf17acacf14.
4v3.
0.
1(2019-12-22)Bugxrelease.
Removemopidy.
localmigrationhelper.
(Fixes:#1861,PR:#1862)14.
5v3.
0.
0(2019-12-22)Thelong-awaitedMopidy3.
0isnallyhere,justintimefortheMopidyproject's10thanniversaryonDecember23rd!
Mopidy3.
0isabackward-incompatiblereleaseinaprettysignicantway:MopidynolongerrunsonPython2.
Mopidy3.
0requiresPython3.
7ornewer.
Whileextensionshavebeenabletocontinueworkingwithoutchangesthroughoutthe1.
xand2.
xseriesofMopidy,thistimeisdifferent:AllextensionsmustbeupdatedtoworkonPython3.
7andnewer.
Someextensionsneedtoreplacetheiruseofafewlong-deprecatedAPIsthatwe'veremoved.
Seebelowfordetails.
Extensionmaintainersarealsoencouragedtoupdatetheirproject'ssetuptomatchourrefreshedextensioncookiecutter.
InparallelwiththedevelopmentofMopidy3.
0,we'vecoordinatedwithafewextensionmaintainersandupgradedalmost20ofthemostpopularextensions.
ThesewillallbepublishedshortlyafterthereleaseofMopidy3.
0.
We'vealsobuiltanewextensionregistry,whereyoucanquicklytrackwhatextensionsarereadyforPython3.
Inothernews,theMopidy-MPDandMopidy-Localextensionshavegrownupandmovedouttoourishasinde-pendentextensionprojects.
Afterthemove,Mopidy-LocalmergedwithMopidy-Local-SQLiteandMopidy-Local-Images,whicharenowbothapartoftheMopidy-Localextension.
14.
5.
1DependenciesPython>=3.
7isnowrequired.
Python2.
7isnolongersupported.
GStreamer>=1.
14.
0isnowrequired.
Pykka>=2.
0.
1isnowrequired.
Tornado>=4.
4isnowrequired.
Theupperboundary(&1|teemopidy.
logorequivalent.
(Fixes:#1452,PR:#1783)Replacedthecongurationslogging/console_formatandlogging/debug_formatwiththesinglecongurationlogging/format.
Itdefaultstothesameformatastheolddebugformat.
(Fixes:#1452,PR:#1783)Addedcongurationlogging/verbositytobeabletocontrolloggingverbosityfromthecongurationle,inadditiontopassing-qor-vonthecommandline.
(Fixes:#1452,PR:#1783)14.
5.
3CoreAPIRemovedproperties,methods,andargumentsthathavebeendeprecatedsince1.
0,releasedin2015.
Everythingremovedalreadyhasareplacement,thatshouldbeusedinstead.
Seebelowforafulllistofremovalsandreplacements.
(Fixes:#1083,#1461,PR:#1768,#1769)RootobjectRemovedproperties,usegetter/setterinstead:–mopidy.
core.
Core.
uri_schemes–mopidy.
core.
Core.
versionLibrarycontrollerRemovedmethods:–mopidy.
core.
LibraryController.
find_exact():Usesearch()withthekeywordargu-mentexact=Trueinstead.
Removedtheuriargumenttomopidy.
core.
LibraryController.
lookup().
Usetheurisargu-mentinstead.
Removedthesupportforpassingthesearchqueryaskeywordargumentstomopidy.
core.
LibraryController.
search().
Usethequeryargumentinstead.
mopidy.
core.
LibraryController.
search()nowreturnsanemptyresultifthereisnoquery.
Pre-viously,itreturnedthefullmusiclibrary.
Thisisnotfeasibleforonlinemusicservicesandhasthusbeendeprecatedsince1.
0.
PlaybackcontrollerRemovedproperties,usegetter/setterinstead:–mopidy.
core.
PlaybackController.
current_tl_track–mopidy.
core.
PlaybackController.
current_track–mopidy.
core.
PlaybackController.
state–mopidy.
core.
PlaybackController.
time_positionMovedtothemixercontroller:14.
5.
v3.
0.
0(2019-12-22)47MopidyDocumentation,Release3.
1.
1-1-gf17acacf–mopidy.
core.
PlaybackController.
get_mute():Useget_mute().
–mopidy.
core.
PlaybackController.
get_volume():Useget_volume().
–mopidy.
core.
PlaybackController.
set_mute():Useset_mute().
–mopidy.
core.
PlaybackController.
set_volume():Useset_volume().
–mopidy.
core.
PlaybackController.
mute:Useget_mute()andset_mute().
–mopidy.
core.
PlaybackController.
volume:Useget_volume()andset_volume().
Deprecatedthetl_trackargumenttomopidy.
core.
PlaybackController.
play(),withthegoalofremovingitinthenextmajorrelease.
Usethetlidargumentinstead.
(Fixes:#1773,PR:#1786,#1854)PlaylistcontrollerRemovedproperties,usegetter/setterinstead:–mopidy.
core.
PlaylistController.
playlistsRemovedmethods:–mopidy.
core.
PlaylistsController.
filter():Useas_list()andlteryourself.
–mopidy.
core.
PlaylistsController.
get_playlists():Useas_list()andget_items().
TracklistcontrollerRemovedproperties,usegetter/setterinstead:–mopidy.
core.
TracklistController.
tl_tracks–mopidy.
core.
TracklistController.
tracks–mopidy.
core.
TracklistController.
length–mopidy.
core.
TracklistController.
version–mopidy.
core.
TracklistController.
consume–mopidy.
core.
TracklistController.
random–mopidy.
core.
TracklistController.
repeat–mopidy.
core.
TracklistController.
singleRemovedtheuriargumenttomopidy.
core.
TracklistController.
add().
Usetheurisargu-mentinstead.
Removedthesupportforpassingltercriteriaaskeywordargumentstomopidy.
core.
TracklistController.
filter().
Usethecriteriaargumentinstead.
Removedthesupportforpassingltercriteriaaskeywordargumentstomopidy.
core.
TracklistController.
remove().
Usethecriteriaargumentinstead.
Deprecatedmethods,withthegoalofremovingtheminthenextmajorrelease:(Fixes:#1773,PR:#1786,#1854)–mopidy.
core.
TracklistController.
eot_track().
Useget_eot_tlid()instead.
–mopidy.
core.
TracklistController.
next_track().
Useget_next_tlid()instead.
48Chapter14.
ChangelogMopidyDocumentation,Release3.
1.
1-1-gf17acacf–mopidy.
core.
TracklistController.
previous_track().
Useget_previous_tlid()instead.
Thetracksargumenttomopidy.
core.
TracklistController.
add()hasbeendeprecatedsinceMopidy1.
0.
Itisstilldeprecated,withthegoalofremovingitinthenextmajorrelease.
Usetheurisargumentinstead.
14.
5.
4BackendAPIAddmopidy.
backend.
PlaybackProvider.
is_live()whichcanbeimplementedbyplaybackprovidersthatwanttomarktheirURIsaslivestreamsthatshouldnotbebuffered.
(PR:#1845)14.
5.
5ModelsRemove.
copy()methodonallmodelclasses.
Usethe.
replace()methodinstead.
(Fixes:#1464,PR:#1774)Removemopidy.
models.
Album.
images.
Clientsshouldusemopidy.
core.
LibraryController.
get_images()instead.
Backendsshouldimplementmopidy.
backend.
LibraryProvider.
get_images().
(Fixes:#1464,PR:#1774)14.
5.
6ExtensionsupportThefollowingmethodsnowreturnpathlib.
Pathobjectsinsteadofstrings:–mopidy.
ext.
Extension.
get_cache_dir()–mopidy.
ext.
Extension.
get_config_dir()–mopidy.
ext.
Extension.
get_data_dir()Thismakesiteasiertosupportarbitraryencodinginlenames.
ThecommandmopidydepsnolongerrepeatsthedependenciesofMopidyitselfforeveryinstalledexten-sion.
Thisreducesthelengthofthecommand'soutputdrastically.
(PR:#1846)14.
5.
7HTTPfrontendStopbundlingMopidy.
jsandservingitat/mopidy/mopidy.
jsand/mopidy/mopidy.
min.
js.
AllMopidywebclientsmustuseMopidy.
jsfromnpmorvendortheirowncopyofthelibrary.
(Fixes:#1083,#1460,PR:#1708)RemovesupportforservingarbitrarylesoverHTTPthroughtheuseofhttp/static_dir,whichhasbeendeprecatedsince1.
0.
(Fixes:#1463,PR:#1706)Addoptionhttp/default_apptoredirectfromwebserverroottoaspecicappinsteadofMopidy'swebapplist.
(PR:#1791)AddcookiesecrettoTornadowebserver,allowingTornadorequesthandlerstocallget_secure_cookie(),inanimplementationofget_current_user().
(PR:#1801)14.
5.
v3.
0.
0(2019-12-22)49MopidyDocumentation,Release3.
1.
1-1-gf17acacf14.
5.
8MPDfrontendTheMopidy-MPDfrontendisnolongerbundledwithMopidy,andhasbeenmovedtoitsownGitrepoandPyPIproject.
14.
5.
9LocalbackendTheMopidy-LocalbackendisnolongerbundledwithMopidy,andhasbeenmovedtoitsownGitrepoandPyPIproject.
(Fixes:#1003)Removedmopidy.
exceptions.
FindError,asitwasonlyusedbyMopidy-Local.
(PR:#1857)14.
5.
10AudioRemovethemethodmopidy.
audio.
Audio.
emit_end_of_stream(),whichhasbeendeprecatedsince1.
0.
(Fixes:#1465,PR:#1705)Addlive_streamoptiontomopidy.
audio.
Audio.
set_uri()thatdisablesbuffering,whichreduceslatencybeforeplaybackstarts,anddiscardsdatawhenpaused.
(PR:#1845)14.
5.
11InternalsFormatcodewithBlack.
(PR:#1834)Porttestassertionsfromunittestmethodstopytestassertstatements.
(PR:#1838)Switchallinternalpathhandlingtousepathlib.
(Fixes:#1744,PR:#1814)Removemopidy.
compatandallPython2/3compatibilitycode.
(PR:#1833,#1835)Replacerequirements.
txtandsetup.
pywithdeclarativeconginsetup.
cfg.
(PR:#1839)Refreshedandupdatedallofourenduser-orienteddocumentation.
50Chapter14.
ChangelogCHAPTERFIFTEENHISTORYThesearethechangelogsforhistoricalreleasesofMopidy.
Forthelatestreleases,seeChangelog.
15.
1Changelog2.
xseriesThisisthechangelogofMopidyv2.
0.
0throughv2.
3.
1.
Forthelatestreleases,seeChangelog.
15.
1.
1v2.
3.
1(2019-10-15)Bugxrelease.
Dependencies:LowerrequirementforTornadofrom>=5,=4.
4,=5,=4.
4.
Core:Removeupperlimitof10000tracksintracklist.
10000tracksisstillthedefaultlimitassomeMPDclientscrashifthetracklistislonger,butitisnowpossibletosetthecore/max_tracklist_lengthcongvalueashighasyouwantto.
(Fixes:#1600,PR:#1666)Core:Fixcrashonlibrary.
lookup(uris=[]).
(Fixes:#1619,PR:#1620)52Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacfCore:Denereturnvalueofplaylists.
delete()tobeabool,Trueonsuccess,Falseotherwise.
(PR:#1702)M3U:Ignoreallattemptsataccessinglesoutsidethem3u/playlist_dir.
(Partlyxes:#1659,PR:#1702)File:Changedefaultorderingtoshowdirectoriesrst,thenles.
(PR:#1595)File:Fixextraneousencodingofpath.
(PR:#1611)HTTP:ProtectRPCandWebSocketinterfacesagainstCSRFbyblockingrequeststhatoriginatefromserversotherthanthosespeciedinthenewcongvaluehttp/allowed_origins.
AnartifactofthisisthatallJSON-RPCrequestsmustnowalwayssettheheaderContent-Type:application/json.
(Partlyxes:#1659,PR:#1668)MPD:Addedidletothelistofavailablecommands.
(Fixes:#1593,PR:#1597)MPD:AddedUnixdomainsocketsforbindingMPDto.
(Fixes:#1531,PR:#1629)MPD:LookuptrackmetadataforMPDloadandlistplaylistinfo.
(Fixes:#1511,PR:#1621)EnsurethatdecodingofOSerrorswithunknownencodingnevercrashes,butinsteadreplacesunknownbyteswithareplacementmarker.
(Fixes:#1599)SetGLibprogramandapplicationname,sothatweshowupas"Mopidy"inPulseAudioinsteadof"python.
.
.
".
(PR:#1626)15.
1.
7v2.
1.
0(2017-01-02)Mopidy2.
1.
0,afeaturerelease,isnallyout!
Sincethereleaseof2.
0.
0,ithasbeenquiettimesinMopidycircles.
Thisismainlycausedbycoredevelopersmovingfromtheenterprisetostartupsorintopositionswithmoreresponsibility,andgettingmorekids.
Ofcourse,thishasgreatlydecreasedtheamountofsparetimeavailableforopensourcework.
Butfearnot,Mopidyisnotdead.
We'vereturnedfromyearlongperiodswithclosetonoactivitybefore,andwillhopefullydosoagain.
Despiteall,we'veclosedormergedapproximately18issuesandpullrequeststhroughabout170commitssincethereleaseofv2.
0.
1backinAugust.
ThemajornewfeatureinMopidy2.
1issupportforrestoringplaybackstateandthecurrentplaylistafterarestart.
ThisfeaturewascontributedbyJensLütjen.
Dependencies:DropsupportforTornado=1.
2.
3,whichwealreadyrequire.
Core:Mopidyrestoresitslaststatewhenstarted.
Canbeenabledbysettingthecongvaluecore/restore_statetotrue.
Audio:UpdatescannertohandlesourcessuchasRTSP.
(Fixes:#1479)Audio:Thescannersetthedatetomopidy.
models.
Track.
dateandmopidy.
models.
Album.
date(Fixes:#1741)File:Addnewcongvaluefile/excluded_file_extensions.
Local:Skiphiddendirectoriesdirectlyinmedia_dir.
(Fixes:#1559,PR:#1555)MPD:FixMPDprotocolforreplay_gain_statuscommand.
Theactualcommandremainsunimple-mented.
(PR:#1520)MPD:AddnextsongandnextsongidtotheresponseofMPDstatuscommand.
(Fixes:#1133,#1516,PR:#1523)15.
1.
Changelog2.
xseries53MopidyDocumentation,Release3.
1.
1-1-gf17acacfMPD:Fixinconsistentplayliststateafterplaylistisemptiedwithrepeatandconsumemodeturnedon.
(Fixes:#1512,PR:#1549)Audio:Improvehandlingofdurationinscanning.
VBRtracksshouldfaillessfrequentlyandMMSworksagain.
(Fixes:#1553,PR#1575,#1576,#1577)15.
1.
8v2.
0.
1(2016-08-16)Bugxrelease.
Audio:Setsoft-volumeagonGStreamer'splaybinelement.
Thisistheplaybin'sdefault,butwemanagedtooverrideitwhenconguringtheplaybintoonlyprocessaudio.
Thisshouldxthe"Volume/muteisnotavailable"warning.
Audio:Fixbufferconversion.
Thisxesimageextraction.
(Fixes:#1469,PR:#1472)Audio:UpdatescanlogictoworkaroundGStreamerissuewheretagsanddurationmightonlybeavailableafterwestartplaying.
(Fixes:#935,#1453,#1474,#1480,PR:#1487)Audio:Betterhandlingofseekwhenpositiondoesnotmatchtheexpectedpendingposition.
(Fixes:#1462,#1505,PR:#1496)Audio:Handlebaddatetagsfromaudio,thankstoMarioLangandTomParkerwhoxedthisinparallel.
(Fixes:#1506,PR:#1525,#1517)Audio:Makesurescannerhandlesstreamswithoutaduration.
(Fixes:#1526)Audio:EnsureaudiotagsareneverNone.
(Fixes:#1449)Audio:Updatemopidy.
audio.
Audio.
set_metadata()topostponesendingtagsifthereisapendingtrackchange.
(Fixes:#1357,PR:#1538)Core:Avoidendlessloopifalltracksinthetracklistareunplayableandconsumemodeisoff.
(Fixes:#1221,#1454,PR:#1455)Core:Correctlyrecordthelastpositionofatrackwhenswitchingtoanotherone.
ParticularlyrelevantforMopidy-Scrobblerusers,asbeforeitwasessentiallyunusable.
(Fixes:#1456,PR:#1534)Models:FixencodingerrorifIdentifierelds,likethemusicbrainz_idmodelelds,containednon-ASCIIUnicodedata.
(Fixes:#1508,PR:#1546)File:Ensurepathcomparisonisdonebetweenbytestringsonly.
Fixescrashwhereafile/media_dirspathcontainednon-ASCIIcharacters.
(Fixes:#1345,PR:#1493)Stream:Fixmillisecondsvssecondsmistakeintimeouthandling.
(Fixes:#1521,PR:#1522)Docs:Fixtherenderingofmopidy.
core.
Coreandmopidy.
audio.
Audiodocs.
ThisshouldalsocontributetowardsmakingtheMopidyDebianpackagebuildbit-by-bitreproducible.
(Fixes:#1500)15.
1.
9v2.
0.
0(2016-02-15)Mopidy2.
0ishere!
Sincethereleaseof1.
1,we'veclosedormergedapproximately80issuesandpullrequeststhroughabout350commitsby14extraordinarypeople,including10newcomers.
That'saboutthesameamountofissuesandcommitsasbetween1.
0and1.
1.
Thenumberofcontributorsisabitlowerbutwedidn'thaveareallifesprintduringthisdevelopmentcycle.
Thankstoeveryonewhohascontributed!
WiththereleaseofMopidy1.
0wepromisedthatanyextensionworkingwithMopidy1.
0shouldcontinueworkingwithallMopidy1.
xreleases.
Mopidy2.
0isquiteafriendlymajorreleaseandwillonlybreakasingleextension54Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacfthatweknowof:Mopidy-Spotify.
Toensurethateverythingcontinuesworking,pleaseupgradetoMopidy2.
0andMopidy-Spotify3.
0atthesametime.
NodeprecatedfunctionalityhasbeenremovedinMopidy2.
0.
ThemajorfeaturesofMopidy2.
0are:Gaplessplaybackhasbeenmostlyimplemented.
Itworksaslongasyoudon'tchangetracksinthemiddleofatrackorusepreviousandnext.
Inafuturerelease,previousandnextwillalsobecomegapless.
ItisnowquiteeasytohaveMopidystreamingaudiooverthenetworkusingIcecast.
SeetheupdatedIcecastdocsfordetailsofhowtosetitupandworkaroundsfortheremainingissues.
MopidyhasupgradedfromGStreamer0.
10to1.
x.
Thishasbeeninourbacklogformorethanthreeyears.
Withthisupgradewe'reriddingourselvesofyearsofGStreamerbugsthathavebeenxedinnewerreleases,wecangetintoDebiantestingagain,andwe'veremovedthelastmajorroadblockforrunningMopidyonPython3.
DependenciesMopidynowrequiresGStreamer>=1.
2.
3,aswe'venallyportedfromGStreamer0.
10.
Sincewe'rerequiringanewmajorversionofourmajordependency,we'reuppingthemajorversionofMopidytoo.
(Fixes:#225)CoreAPIStarttlidcountingat1insteadof0tokeepinsyncwithMPD'ssongid.
get_time_position()nowreturnstheseektargetwhileaseekisinprogress.
Thisgivesbetterresultsthanjustfailingthepositionquery.
(Fixes:#312PR:#1346)Addmopidy.
core.
PlaylistsController.
get_uri_schemes().
(PR:#1362)Thetrack_playback_endedeventnowincludesthecorrecttl_trackreferencewhenchangingtothenexttrackinconsumemode.
(Fixes:#1402PR:#1403PR:#1406)ModelsDeprecated:mopidy.
models.
Album.
imagesisdeprecated.
Usemopidy.
core.
LibraryController.
get_images()instead.
(Fixes:#1325)ExtensionsupportLogexceptionandcontinueifanextensioncrashesduringsetup.
Previously,weletMopidycrashifanexten-sion'ssetupcrashed.
(PR:#1337)LocalbackendMadelocal/data_dirreallydeprecated.
ThischangebreaksolderversionsofMopidy-Local-SQLiteandMopidy-Local-Images.
15.
1.
Changelog2.
xseries55MopidyDocumentation,Release3.
1.
1-1-gf17acacfM3UbackendAddm3u/base_dirforresolvingrelativepathsinM3Ules.
(Fixes:#1428,PR:#1442)Derivetracknamefromlenamefornon-extendedM3Uplaylists.
(Fixes:#1364,PR:#1369)MajorrefactoringoftheM3Uplaylistextension.
(Fixes:#1370PR:#1386)–Addm3u/default_encodingandm3u/default_extensioncongvaluesforimprovedtextencodingsupport.
–Nolongerscanplaylistdirectoryandparseplaylistsatstartuporrefresh.
Similarlytotheleextension,thisnowhappensonrequest.
–Usemopidy.
models.
Refinstanceswhenreadingandwritingplaylists.
Therefore,Track.
lengthisnolongerstoredinextendedM3Uplaylistsand#EXTINFruntimeisalwayssetto-1.
–ImprovereliabilityofplaylistupdatesusingthecoreplaylistAPIbyapplyingthewrite-replacepatternforleupdates.
StreambackendMakesurebothlookupandplaybackcorrectlyhandleplaylistsandourblacklistsupport.
(Fixes:#1445,PR:#1447)MPDfrontendImplementedcommandsformodifyingstoredplaylists:–playlistadd–playlistclear–playlistdelete–playlistmove–rename–rm–save(Fixes:#1014,PR:#1187,#1308,#1322)Startsongidcountingat1insteadof0tomatchtheoriginalMPDserver.
Idleeventsarenowemittedonseekedevents.
Thisxmeansthatclientsrelyingonidleeventsnowgetnotiedaboutseeks.
(Fixes:#1331,PR:#1347)Idleeventsarenowemittedonplaylists_loadedevents.
Thisxmeansthatclientsrelyingonidleeventsnowgetnotiedaboutplaylistloads.
(Fixes:#1331,PR:#1347)Eventhandlerforplaylist_deletedhasbeenunbroken.
ThisunreportedbugwouldcausetheMPDfrontendtocrashpreventinganyfurthercommunicationviatheMPDprotocol.
(PR:#1347)56Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacfZeroconfRequirestypeargumenttomopidy.
zeroconf.
Zeroconf.
UseAvahi'sinterfaceselectionbydefault.
(Fixes:#1283)UseAvahiserver'shostnameinsteadofsocket.
getfqdn()inservicedisplayname.
CleanupsRemovedwarningif~/.
mopidyexists.
Westoppedusingthislocationin0.
6,releasedinOctober2011.
Removedwarningif~/.
config/mopidy/settings.
pyexists.
Westoppedusingthissettingslein0.
14,releasedinApril2013.
Theon_eventhandlerinourlistenerhelpernowcatchesexceptions.
Thismeansthatanyerrorsineventhandlingwon'tcrashtheactorinquestion.
Catcherrorswhenloadinglogging/config_file.
(Fixes:#1320)Breaking:Removedunusedinternalmopidy.
internal.
process.
BaseThread.
ThisbreaksMopidy-Spotify1.
4.
0.
Versions=2.
0doesn'tusethisclass.
AudioBreaking:TheaudioscannernowreturnsISO-8601formattedstringsinsteadofdatetimeobjectsfordatesfoundintags.
Becauseofthischange,wecannowreturnyearswithoutmonthsordays,whichmatchesthesemanticsofthedateeldsinourdatamodels.
Breaking:mopidy.
audio.
Audio.
set_appsrc()'scapsargumenthaschangedformatduetotheup-gradefromGStreamer0.
10toGStreamer1.
Asfarasweknow,thisisonlyusedbyMopidy-Spotify.
Asanexample,withGStreamer0.
10theMopidy-Spotifycapswas:audio/x-raw-int,endianness=(int)1234,channels=(int)2,width=(int)16,depth=(int)16,signed=(boolean)true,rate=(int)44100WithGStreamer1thischangesto:audio/x-raw,format=S16LE,rate=44100,channels=2,layout=interleavedIfyourMopidybackendusesset_appsrc(),pleaserefertoGStreamerdocumentationfordetailsonthenewcapsstringformat.
Breaking:mopidy.
audio.
utils.
create_buffer()'scapabilitiesargumentisnolongerinuseandhasbeenremoved.
Asfarasweknow,thiswasonlyusedbyMopidy-Spotify.
Duplicateseekeventsgettingtoappsrcbasedbackendsisnowxed.
ThisshouldpreventseekinginMopidy-Spotifyfromglitching.
(Fixes:#1404)Workaroundcrashcausedbyaracethatdoesnotseemtoaffectfunctionality.
Thisshouldbexedproperlytogetherwith#1222.
(Fixes:#1430,PR:#1438)Addanewcongoption,audio/buffer_time,forsettingthebuffertimeoftheGStreamerqueue.
Ifyouexperiencebufferingbeforetrackchanges,itmayhelptoincreasethis.
(Workaroundfor#1409)tags_changedeventsareonlyemittedforeldsthathavechanged.
PreviousbehaviorwastoemitthisforalleldsreceivedfromGStreamer.
(PR:#1439)15.
1.
Changelog2.
xseries57MopidyDocumentation,Release3.
1.
1-1-gf17acacfGaplessAddpartialsupportforgaplessplayback.
Gaplessnowworksaslongasyoudon'tchangetracksorusenext/previous.
(PR:#1288)TheIcecastdocshasbeenupdatedwiththeworkaroundsstillneededtoproperlystreamMopidyaudiothroughIcecast.
Coreplaybackhasbeenrefactoredtobetterhandlegapless,andasyncstatechanges.
Testshavebeenupdatedtoalwaysuseacoreactorsoasyncstatechangesdon'ttripusup.
Seekeventsarenowtriggeredwhentheseekcompletes.
Previouslytheeventwasemittedwhentheseekwasrequested,notwhenitcompleted.
Furtherchangeshavebeenmadetomakeseekworkcorrectlyforgaplessrelatedcornercases.
(Fixes:#1305PR:#1346)15.
2Changelog1.
xseriesThisisthechangelogofMopidyv1.
0.
0throughv1.
1.
2.
Forthelatestreleases,seeChangelog.
15.
2.
1v1.
1.
2(2016-01-18)Bugxrelease.
Main:Catcherrorswhenloadingthelogging/config_filele.
(Fixes:#1320)Core:Ifchangingtoanothertrackwhiletheplayerispaused,thenewtrackwouldnotbeaddedtothehistoryormarkedascurrentlyplaying.
(Fixes:#1352,PR:#1356)Core:Skipsoverunplayabletracksiftheuserattemptstochangetrackswhilepaused,likewealreadydidifinplayingstate.
(Fixes#1378,PR:#1379)Core:Makelookup()ignoretrackswithemptyURIs.
(Partlyxes:#1340,PR:#1381)Core:Fixcrashifbackendsemitseventswithwrongnamesorarguments.
(Fixes:#1383)Stream:IfanURIisconsideredplayable,don'tconsideritasacandidateforplaylistparsing.
JustlookingatMIMEtypeprexesisn'tenough,asforexampleOggVorbishastheMIMEtypeapplication/ogg.
(Fixes:#1299)Local:Ifthescanorclearcommandsareusedonalibrarythatdoesnotexist,exitwithanerror.
(Fixes:#1298)MPD:Notifyidlingclientswhenaseekisperformed.
(Fixes:#1331)MPD:Don'treturntrackswithemptyURIs.
(Partlyxes:#1340,PR:#1343)MPD:Addvolumecommandthatwasreintroduced,thoughstillasadeprecatedcommand,inMPD0.
18andisinusebysomeclientslikempc.
(Fixes:#1393,PR:#1397)Proxy:Handlecasewhereproxy/portiseithermissingfromcongorsettoanemptystring.
(PR:#1371)58Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacf15.
2.
2v1.
1.
1(2015-09-14)Bugxrelease.
Dependencies:SpecifythatweneedRequests>=2.
0,notjustanyversion.
ThisensuresthatwefailearlierifMopidyisusedwithatoooldRequests.
Core:Makemopidy.
core.
LibraryController.
refresh()workforallbackendswithalibraryprovider.
Previously,itwronglyworkedforallbackendswithaplaylistsprovider.
(Fixes:#1257)Core:Respectcore/cache_dirandcore/data_dircongvaluesaddedin1.
1.
0whencreatingthedirsMopidyneedtostoredata.
ThisshouldnotchangethebehaviorfordesktopusersrunningMopidy.
WhenrunningMopidyasasystemserviceinstalledfromapackagewhichsetsthecoredircongsproperly(e.
g.
DebianandArchpackages),thisxavoidsthecreationofacoupleofdirectoriesthatshouldnotbeused,typically/var/lib/mopidy/.
localand/var/lib/mopidy/.
cache.
(Fixes:#1259,PR:#1266)Core:Fixerroringet_eot_tlid()docstring.
(Fixes:#1269)Audio:Addtimeoutparametertoscan().
(Partof:#1250,PR:#1281)Extensionsupport:Makeget_cache_dir(),get_config_dir(),andget_data_dir()classmeth-ods,sotheycanbeusedwithoutcreatinganinstanceoftheExtensionclass.
(Fixes:#1275)Local:Deprecatelocal/data_dirandrespectcore/data_dirinstead.
Thisdoesnotchangethede-faultsfordesktopusers,onlysystemservicesinstalledfrompackagesthatproperlysetcore/data_dir,liketheDebianandArchpackages.
(Fixes:#1259,PR:#1266)Local:Changedefaultvalueoflocal/scan_flush_thresholdfrom1000to100toshortenthetimeMopidy-Local-SQLiteblocksincomingrequestswhilescanningthelocallibrary.
M3U:Changeddefaultforthem3u/playlists_dirfrom$XDG_DATA_DIR/mopidy/m3utounset,whichnowmeanstheextension'sdatadir.
Thisdoesnotchangethedefaultsfordesktopusers,onlysys-temservicesinstalledfrompackagesthatproperlysetcore/data_dir,liketheDebianandArchpakages.
(Fixes:#1259,PR:#1266)Stream:ExpandnestedplayliststondthestreamURI.
Thisusedtowork,butregressedin1.
1.
0withtheextractionofstreamplaylistparsingfromGStreamertobeinghandledbytheMopidy-Streambackend.
(Fixes:#1250,PR:#1281)Stream:If"le"ispresentinthestream/protocolscongvalueandtheMopidy-Fileextensionisenabled,weexitedwithanerrorbecausetwoextensionsclaimedthesameURIscheme.
Wenowlogawarningrecom-mendingtoremove"le"fromthestream/protocolscong,andthenproceedstartup.
(Fixes:#1248,PR:#1254)Stream:Fixbuginnewplaylistparser.
Anon-ASCIIcharinanurilistcommentwouldcauseacrashwhileparsingduetocomparisonofanon-ASCIIbytestringwithaUnicodestring.
(Fixes:#1265)File:Adjustloglevelswhenfailingtoexpand$XDG_MUSIC_DIRintoarealpath.
ThisusuallyhappenswhenrunningMopidyasasystemservice,andthuswithalimitedsetofenvironmentvariables.
(Fixes:#1249,PR:#1255)File:Whenbrowsingles,wenolongerscanthelestocheckifthey'replayable.
ThismakesbrowsingofthelehierarchyinstantforHTTPclients,whichdonoscanningoftheles'metadata,andabitfasterforMPDclients,whichnolongerscanthelestwice.
(Fixes:#1260,PR:#1261)File:Allowlookingupmetadataaboutanyfile://URI,justlikewedidinMopidy1.
0.
x,whereMopidy-Streamhandledfile://URIs.
InMopidy1.
1.
0,Mopidy-Filedidnotallowonetolookuplesoutsidethedirectorieslistedinfile/media_dir.
ThisbrokeMopidy-Local-SQLitewhenthelocal/media_dirdirectorywasnotwithinoneofthefile/media_dirsdirectories.
Forbrowsingofles,westilllimitaccesstolesinsidethefile/media_dirdirectories.
Forlookup,youcannowreadmetadataforanyleyouknowthepathof.
(Fixes:#1268,PR:#1273)15.
2.
Changelog1.
xseries59MopidyDocumentation,Release3.
1.
1-1-gf17acacfAudio:Fixtimeouthandlinginscanner.
Thisregressioncausedtimeoutstoexpirebeforeitshould,causingscanstofail.
Audio:UpdatescannertoemitMIMEtypeinsteadofanerrorwhenmissingaplugin.
15.
2.
3v1.
1.
0(2015-08-09)Mopidy1.
1ishere!
Sincethereleaseof1.
0,we'veclosedormergedapproximately65issuesandpullrequeststhroughabout400commitsbyarecordhigh20extraordinarypeople,including14newcomers.
That'slessissuesandcommitsthaninthe1.
0release,butevenmorecontributors,andadoublingofthenumberofnewcomers.
Thankstoeveryonewhohascontributed,especiallythosethatjoinedthesprintatEuroPython2015inBilbao,Spainacoupleofweeksago!
AswepromisedwiththereleaseofMopidy1.
0,anyextensionworkingwithMopidy1.
0shouldcontinueworkingwithallMopidy1.
xreleases.
However,thisreleasebringsalotstrongerenforcementofourdocumentedAPIs.
Ifanextensiondoesn'tusetheAPIsproperly,itmaynolongerwork.
TheadvantageofthischangeisthatMopidyisnowmorerobustagainsterrorsinextensions,andalsoprovidesvastlybettererrormessageswhenextensionsmisbehave.
Thisshouldmakeiteasiertocreatequalityextensions.
ThemajorfeaturesofMopidy1.
1are:ValidationoftheargumentstoallcoreAPImethods,aswellasallresponsesfrombackendsandalldatamodelattributes.
Newbundledbackend,Mopidy-File.
ItissimilartoMopidy-Local,butallowsyoutobrowseandplaymusicfromlocaldiskwithoutrunningascantoindexthemusicrst.
Thedrawbackisthatitdoesn'tsupportsearching.
TheMopidy-MPDservershouldnowbeuptodatewiththe0.
19versionoftheMPDprotocol.
DependenciesMopidynowrequiresRequests.
Headsup:PortingfromGStreamer0.
10to1.
xandsupportforrunningMopidywithPython3.
4+isnotfaroffonourroadmap.
CoreAPIDeprecated:Callingthefollowingmethodswithkwargsisbeingdeprecated.
(PR:#1090)–mopidy.
core.
LibraryController.
search()–mopidy.
core.
PlaylistsController.
filter()–mopidy.
core.
TracklistController.
filter()–mopidy.
core.
TracklistController.
remove()Updatedcorecontrollerstohandlebackendexceptionsinallcallsthatrelyonmultiplebackends.
(Issue:#667)Updatecoremethodstodostrictinputchecking.
(Fixes:#700)Addtlidalternativestomethodsthattaketl_trackandalsoaddget_{eot,next,previous}_tlidmethodsaslightweightalternativestothetl_trackversionsofthecalls.
(Fixes:#1131,PR:#1136,#1140)Addmopidy.
core.
PlaybackController.
get_current_tlid().
(Partof:#1137)Updatecoretohandlebackendcrashesandbaddata.
(Fixes:#1161)Addcore/max_tracklist_lengthcongandlimitation.
(Fixes:#997PR:#1225)60Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacfAddedplaylist_deletedevent.
(Fixes:#996)ModelsAddedtypechecksandothersanitycheckstomodelconstructionandserialization.
(Fixes:#865)Memoryusageformodelshasbeengreatlyimproved.
Wenowhavealoweroverheadperinstancebyusingslots,internedidentiersandautomaticallyreuseinstances.
Forthetestdatasetthiswasdevelopedagainst,alibraryof~14.
000tracks,wentfromneeding~75MBto~17MB.
(Fixes:#348)Addedmopidy.
models.
Artist.
sortnameeldthatismappedtomusicbrainz-sortnametag.
(Fixes:#940)CongurationAddnewcongurationstosetbasedirectoriestobeusedbyMopidyandMopidyextensions:core/cache_dir,core/config_dir,andcore/data_dir.
(Fixes:#843,PR:#1232)ExtensionsupportAddnewmethodstoExtensionclassforgettingcache,conganddatadirectoriesspecictoyourextension:–mopidy.
ext.
Extension.
get_cache_dir()–mopidy.
ext.
Extension.
get_config_dir()–mopidy.
ext.
Extension.
get_data_dir()ExtensionsshouldusethesemethodssothatthecorrectdirectoriesareusedbothwhenMopidyisrunbyaregularuserandwhenrunasasystemservice.
(Fixes:#843,PR:#1232)Addmopidy.
httpclient.
format_proxy()andmopidy.
httpclient.
format_user_agent().
(Partof:#1156)Itisnowpossibletoimportmopidy.
backendswithouthavingGObjectorGStreamerinstalled.
Inotherwords,alotofbackendextensionsshouldnowbeabletoruntestsinavirtualenvwithglobalsite-packagesdisabled.
Thisremovesalotofpotentialerrorsources.
(Fixes:#1068,PR:#1115)LocalbackendFilteroutNonefromget_distinct()results.
Allreturnedresultsshouldbestrings.
(Fixes:#1202)StreambackendMovestreamplaylistparsingfromGStreamertothestreambackend.
(Fixes:#671)15.
2.
Changelog1.
xseries61MopidyDocumentation,Release3.
1.
1-1-gf17acacfFilebackendTheMopidy-Filebackendisanewbundledbackend.
ItissimilartoMopidy-Localsinceitworkswithlocalles,butitdiffersinafewkeyways:Mopidy-Fileletsyoubrowseyourmedialesbytheirlehierarchy.
Itsupportsmultiplemediadirectories,allexposedunderthe"Files"directorywhenyoubrowseyourlibrarywithe.
g.
anMPDclient.
Thereisnoindexofthemediales,liketheJSONorSQLitelesusedbyMopidy-Local.
ThusnoneedtoscanthemusiccollectionbeforestartingMopidy.
EverythingisreadfromthelesystemwhenneededandchangestothelesystemisthusimmediatelyvisibleinMopidyclients.
Becausethereisnoindex,thereisnosupportforsearch.
OurlongtermplanistokeepthisverysimplelebackendinMopidy,asithasawelldenedandlimitedscope,whilesplittingthemorefeaturerichMopidy-Localextensionouttoanindependentproject.
(Fixes:#1004,PR:#1207)M3UbackendSupportloadingUTF-8encodedM3Uleswiththe.
m3u8leextension.
(PR:#1193)MPDfrontendTheMPDcommandcountnowignorestrackswithnolength,whichwouldpreviouslycauseaTypeError.
(PR:#1192)Concatenatemultipleartists,composersandperformersusingthe"A;B"formatinsteadof"A,B".
ThisisapartofupdatingourprotocolimplementationtomatchMPD0.
19.
(PR:#1213)Add"notimplemented"skeletonsofnewcommandsintheMPDprotocolversion0.
19:–Currentplaylist:*rangeid*addtagid*cleartagid–Mountsandneighbors:*mount*unmount*listmounts*listneighbors–MusicDB:*listfilesTrackdatanowincludetheLast-Modifiedeldifsetonthetrackmodel.
(Fixes:#1218,PR:#1219)ImplementtagtypesMPDcommand.
(PR:#1235)Excludeemptytagseldsfrommetadataoutput.
(Fixes:#1045,PR:#1235)ImplementprotocolextensionstooutputAlbumURIsandAlbumImageswhenoutputtingtrackdatatoclients.
(PR:#1230)62Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacfTheMPDcommandslsinfoandlistplaylistsarenowimplementedusingtheas_list()method,whichretrievesalotlessdataandisthusmuchfasterthanthedeprecatedget_playlists().
ThedrawbackisthattheLast-Modifiedtimestampisnotavailablethroughthismethod,andthetimestampsintheMPDcommandresponsesarenowalwayssettothecurrenttime.
InternalchangesTestshavebeencleaneduptostopusingdeprecatedAPIswherefeasible.
(Partialx:#1083,PR:#1090)15.
2.
4v1.
0.
8(2015-07-22)Bugxrelease.
FixreversalofTitleandNameinMPDprotocol(Fixes:#1212PR:#1214)FixcrashifanM3Uleinthem3u/playlist_dirdirectoryhasalenamenotdecodablewiththecurrentlesystemencoding.
(Fixes:#1209)15.
2.
5v1.
0.
7(2015-06-26)Bugxrelease.
FixerrorintheMPDcommandlisttitle.
.
.
.
Theerrorwasintroducedinv1.
0.
6.
15.
2.
6v1.
0.
6(2015-06-25)Bugxrelease.
Core/MPD/Local:Addsupportfortitleinmopidy.
core.
LibraryController.
get_distinct().
(Fixes:#1181,PR:#1183)Core:Makesuretrackchangesmakeittoaudiowhilepaused.
(Fixes:#1177,PR:#1185)15.
2.
7v1.
0.
5(2015-05-19)Bugxrelease.
Core:Addworkaroundforplaylistprovidersthatdonotsupportcreatingplaylists.
(Fixes:#1162,PR#1165)M3U:Fixencodingerrorwhensavingplaylistswithnon-ASCIItracktitles.
(Fixes:#1175,PR#1176)15.
2.
8v1.
0.
4(2015-04-30)Bugxrelease.
Audio:Sinceallpreviousattemptsattweakingthequeuingfor#1097seemstobreakthingsinsubtlewaysfordifferentusers.
Wearegivingupontweakingthedefaultsandjustgoingtolivewithabitmorelagonsoftwarevolumechanges.
(Fixes:#1147)15.
2.
Changelog1.
xseries63MopidyDocumentation,Release3.
1.
1-1-gf17acacf15.
2.
9v1.
0.
3(2015-04-28)Bugxrelease.
HTTP:Anotherfollow-uptotheTornado=2.
3,insteadof>=3.
1.
ThisshouldmakeMopidycontinuetoworkonDebian/Raspbianstable,whereTornado2.
3isthenewestversionavailable.
HTTPfrontend:Addmissingstringinterpolationplaceholder.
Development:mopidy--versionandmopidy.
core.
Core.
get_version()nowreturnsthecor-rectversionwhenMopidyisrunfromaGitrepootherthanMopidy'sown.
(Relatedto#706)15.
3.
6v0.
19.
0(2014-07-21)Thefocusof0.
19havebeenonimprovingtheMPDimplementation,replacingGStreamermixerswithourownmixerAPI,andonmakingwebclientsinstallablewithpip,likeanyotherMopidyextension.
Sincethereleaseof0.
18,we'veclosedormerged53issuesandpullrequeststhroughabout445commitsby12people,includingvenewguys.
Thankstoeveryonethathascontributed!
DependenciesMopidynowrequiresTornado>=3.
1.
MopidynolongerrequiresCherryPyorws4py.
Previously,thesewereoptionaldependenciesrequiredfortheHTTPfrontendtowork.
BackendAPIBreakingchange:ImportsofthebackendAPIfrommopidy.
backendsnolongerworks.
ThenewAPIintroucedinv0.
18isnowrequired.
MostextensionsalreadyusethenewAPIlocation.
CommandsThemopidy-convert-configtoolformigratingthesetings.
pycongurationleusedbyMopidyupuntil0.
14tothenewcongleformathasbeenremovedafteroverayearoftrustyservice.
Ifyoustillneedtoconvertyouroldsettings.
pycongurationle,dosousingandolderrelease,likeMopidy0.
18,ormigratethecongurationtothenewformatbyhand.
CongurationAddoptional=Truesupporttomopidy.
config.
Boolean.
LoggingFixproperdecodingofexceptionmessagesthatdependsontheuser'slocale.
Colorizelogsdependingonloglevel.
Thiscanbeturnedoffwiththenewlogging/colorconguration.
(Fixes:#772)ExtensionsupportBreakingchange:RemovedtheExtensionmethodsthatweredeprecatedin0.
18:get_backend_classes(),get_frontend_classes(),andregister_gstreamer_elements().
Usemopidy.
ext.
Extension.
setup()instead,asmostextensionsalreadydo.
AudioBreakingchange:RemovedsupportforGStreamermixers.
GStreamer1.
xdoesnotsupportvolumecontrol,sowechangedtousesoftwaremixingbydefaultinv0.
17.
0.
Now,we'reremovingsupportforallotherGStreamermixersandarereintroducingmixersassomethingextensionscanprovideindependentlyofGStreamer.
(Fixes:#665,PR:#760)15.
3.
Changelog0.
xseries73MopidyDocumentation,Release3.
1.
1-1-gf17acacfBreakingchange:Changedtheaudio/mixercongvaluetorefertoMopidymixerextensionsinsteadofGStreamermixers.
Thedefaultvalue,software,stillhasthesamebehavior.
Allothervalueswilleithernolongerworkorwillattheveryleastrequireyoutoinstallanadditionalextension.
Changedtheaudio/mixer_volumecongvaluebehaviorfromaffectingGStreamermixerstoaffectingMopidymixerextensionsinstead.
Theendresultshouldbethesamewithoutanychangestothiscongvalue.
Deprecatedtheaudio/mixer_trackcongvalue.
Thiscongvalueisnolongerinuse.
Mixerextensionsthatneedadditionalcongurationhandlethisthemselves.
UseProxysectionwhenstreamingmediafromtheInternet.
(Partlyxing#390)Fixproperdecodingofexceptionmessagesthatdependsontheuser'slocale.
FixrecognitionofASXandXSPFplaylistswithtagsinallcapsorwithcarriagereturnlineendings.
(Fixes:#687)SupportsimplerASXplaylistvariantwithelementswithoutchildren.
Addedtarget_stateattributetotheaudiolayer'sstate_changed()event.
Currently,itisNoneex-ceptwhenwe'repausedbecauseofbuffering.
Thentheneweldexposesourtargetstateafterbufferinghascompleted.
MixersAddednewmopidy.
mixer.
MixerAPIwhichcanbeimplementedbyextensions.
Createdabundledextension,Mopidy-SoftwareMixer,forcontrollingvolumeinsoftwareinGStreamer'spipeline.
ThisisMopidy'sdefaultmixer.
Tousethismixer,settheaudio/mixercongvaluetosoftware.
Createdanexternalextension,Mopidy-ALSAMixer,forcontrollingvolumewithhardwarethroughALSA.
Tousethismixer,installtheextension,andsettheaudio/mixercongvaluetoalsamixer.
HTTPfrontendCherryPyandws4pyhavebeenreplacedwithTornado.
ThiswillhopefullyreduceCPUusageonOSX(#445)andimproveerrorhandlingincornercases,likewhenreturningfromsuspend(#718).
AddedsupportforpackagingwebclientsasMopidyextensionsandinstallingthemusingpip.
SeetheHTTPserversideAPIfordetails.
(Fixes:#440)Addedwebpageat/mopidy/whichlistsallwebclientsinstalledasMopidyextensions.
(Fixes:#440)AddedsupportforextendingtheHTTPfrontendwithadditionalserversidefunctionality.
SeeHTTPserversideAPIfordetails.
ExposedthecoreAPIusingHTTPPOSTrequestswithJSON-RPCpayloadsat/mopidy/rpc.
ThisisthesameJSON-RPCinterfaceasisexposedovertheWebSocketat/mopidy/ws,soyoucanrunanycoreAPIcommand.
TheHTTPPOSTinterfacesdoesnotgiveyouaccesstoeventsfromMopidy,liketheWebSocketdoes.
TheWebSocketinterfaceisstillrecommendedforwebclients.
TheHTTPPOSTinterfacemaybeeasiertouseforsimplerprograms,thatjustneedstoquerythecurrentlyplayingtrackorsimilar.
SeeHTTPPOSTAPIfordetails.
IfZeroconfisenabled,wenowannouncethe_mopidy-http.
_tcpserviceinadditionto_http.
_tcp.
ThisistomakeiteasiertoautomaticallyndMopidy'sHTTPserveramongotherZeroconf-publishedHTTPserversonthelocalnetwork.
Mopidy.
jsclientlibraryThisversionhasbeenreleasedtonpmasMopidy.
jsv0.
4.
0.
UpdateMopidy.
jstousewhen.
js3.
IfyoumaintainaMopidyclient,youshouldreviewthedifferencesbetweenwhen.
js2and3andthewhen.
jsdebuggingguide.
74Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacfAllofMopidy.
js'promiserejectionvaluesarenowoftheErrortype.
ThisensuresthatallJavaScriptVMswillshowausefulstacktraceifarejectedpromise'svalueisusedtothrowanexception.
Toallowcatchclausestohandledifferenterrorsdifferently,serversideerrorsareofthetypeMopidy.
ServerError,andconnectionrelatederrorsareofthetypeMopidy.
ConnectionError.
Addsupportformethodcallswithby-namearguments.
Theoldcallingconvention,by-position-only,isstillthedefault,butthiswillchangeinthefuture.
Awarningisloggedtotheconsoleifyoudon'texplicitlyselectacallingconvention.
SeetheMopidy.
jsJavaScriptlibrarydocsfordetails.
MPDfrontendPropercommandtokenizationforMPDrequests.
ThisreplacestheoldregexbasedsystemwithanMPDpro-tocolspecictokenizerresponsibleforbreakingrequestsintopiecesbeforethehandlershaveatthem.
(Fixes:#591and#592)Updatedcommandhandlersystem.
Aspartofthetokenizercleanupwe'veupdatedhowcommandsareregis-teredandmakingitsimplertocreatenewhandlers.
Simpliedabunchofhandlers.
Allthe"browse"typecommandsnowuseacommonbrowsehelperunderthehoodforlessrepetition.
Likewisethequeryhandlingof"search"commandshasbeensomewhatsimplied.
AddsplaceholdersformissingMPDcommands,preparingthewayforbumpingtheprotocolversiononcetheyhavebeenadded.
Respondtoallpendingrequestsbeforeclosingconnection.
(PR:#722)StopincorrectlycatchingLookupErrorincommandhandling.
(Fixes:#741)Browsesupportforplaylistsandalbumshasbeenadded.
(PR:#749,#754)Thelsinfocommandnowreturnsbrowseresultsbeforelocalplaylists.
Thisishelpfulasnotallclientssortthereturneditems.
(PR:#755)Browsenowsupportsdifferententrieswithidenticalnames.
(PR:#762)Searchtermsthatareemptyorconsistsofonlywhitespacearenolongerincludedinthesearchquerysenttobackends.
(PR:#758)LocalbackendTheJSONlocallibrarybackendnowlogsafriendlymessagetellingyouaboutmopidylocalscanifyoudon'thavealocallibrarycache.
(Fixes:#711)Thelocalscancommandnowusemultiplethreadstowalkthelesystemandcheckles'modicationtime.
Thisspeedsupscanning,escpeciallywhenscanningremotelesystemsovere.
g.
NFS.
thelocalscancommandnowcreatesnecessaryfoldersiftheydon'talreadyexist.
Previously,thiswasonlydonebytheMopidyserver,sodoingalocalscanbeforerunningtheserverthersttimeresultedinacrash.
(Fixes:#703)Fixproperdecodingofexceptionmessagesthatdependsontheuser'slocale.
StreambackendAddcongvaluestream/metadata_blacklisttoblacklistcertainURIsweshouldnotopentoreadmetadatafrombeforetheyareopenedforplayback.
ThisistypicallyneededforservicesthatinvalidateURIsafterasingleuse.
(Fixes:#660)15.
3.
Changelog0.
xseries75MopidyDocumentation,Release3.
1.
1-1-gf17acacf15.
3.
7v0.
18.
3(2014-02-16)Bugxrelease.
Fixdocumentationbuild.
15.
3.
8v0.
18.
2(2014-02-16)Bugxrelease.
Wenowlogwarningsforwronglyconguredextensions,andclearlylabeltheminmopidyconfig,butdoesnolongerstopMopidyfromstartingbecauseofmisconguredextensions.
(Fixes:#682)FixacrashintheserversideWebSockethandlercausedbyconnectionproblemswithclients.
(Fixes:#428,#571)Fixthetime_positioneldofthetrack_playback_endedevent,whichhasbeenalways0sincev0.
18.
0.
ThismadescrobblesbyMopidy-ScrobblernotbepersistedbyLast.
fm,becauseMopidyreportedthatyoulistenedto0secondsofeachtrack.
(Fixes:#674)Fixthelogsetupsothatitispossibletoincreasetheamountofloggingfromaspecicloggerusingtheloglevelscongsection.
(Fixes:#684)SerializationofPlaylistmodelswiththelast_modifiedeldsettoadatetime.
datetimeinstancedidnotwork.
Thetypeofmopidy.
models.
Playlist.
last_modifiedhasbeenredenedfromadatetime.
datetimeinstancetothenumberofmillisecondssinceUnixepochasaninteger.
Thismakesserializationofthetimestampsimpler.
MinorrefactoroftheMPDservercontextsothatMopidy'sMPDprotocolimplementationcaneasierbereused.
(Fixes:#646)NetworkandsignalhandlinghasbeenupdatedtoplayniceonWindowssystems.
15.
3.
9v0.
18.
1(2014-01-23)Bugxrelease.
Disableextensioninsteadofcrashingifadependencyhasthewrongversion.
(Fixes:#657)Makeloggingworktobothconsole,debuglogle,andanycustomloggingsetupfromlogging/config_fileatthesametime.
(Fixes:#661)15.
3.
10v0.
18.
0(2014-01-19)Thefocusof0.
18havebeenontwofronts:thelocallibraryandbrowsing.
First,thelocallibrary'soldtagcacheleusedforstoringthetrackmetadatascannedfromyourmusiccollectionhasbeenreplacedwithafarsimplerimplementationusingJSONasthestorageformat.
Atthesametime,thelocallibraryhavebeenmadereplaceablebyextensions,soyoucannowcreateextensionsthatuseyourfavoritedatabasetostorethemetadata.
Second,we'venallyimplementedthelongawaited"lesystem"browsingfeaturethatyouknowfromMPD.
ItissupportedbyboththeMPDfrontendandthelocalandSpotifybackends.
ItisalsousedbythenewMopidy-DirbleextensiontoprovideyouwithadirectoryofInternetradiostationsfromallovertheworld.
Sincethereleaseof0.
17,we'veclosedormerged49issuesandpullrequeststhroughabout285commitsby11people,includingsixnewguys.
Thankstoeveryonethathascontributed!
76Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacfCoreAPIAddmopidy.
core.
Core.
version()forHTTPclientstomanagecompatibilitybetweenAPIversions.
(Fixes:#597)Addmopidy.
models.
Refclassforuseasalightweightreferencetoothermodeltypes,containingjustanURI,aname,andanobjecttype.
Itisbarelyusedfornow,butitsusewillbeextendedovertime.
Addmopidy.
core.
LibraryController.
browse()methodforbrowsingavirtuallesys-temoftracks.
Backendscanimplementsupportforthisbyimplementingmopidy.
backend.
LibraryProvider.
browse().
Eventsemittedonplay/stop,pause/resume,next/previousandonendoftrackhasbeencleaneduptoworkconsistently.
Seethemessageofcommit1d108752f6forthefulldetails.
(Fixes:#629)BackendAPIMovethebackendAPIclassesfrommopidy.
backends.
basetomopidy.
backendandremovetheBaseprexfromtheclassnames:–Frommopidy.
backends.
base.
Backendtomopidy.
backend.
Backend–Frommopidy.
backends.
base.
BaseLibraryProvidertomopidy.
backend.
LibraryProvider–Frommopidy.
backends.
base.
BasePlaybackProvidertomopidy.
backend.
PlaybackProvider–Frommopidy.
backends.
base.
BasePlaylistsProvidertomopidy.
backend.
PlaylistsProvider–Frommopidy.
backends.
listener.
BackendListenertomopidy.
backend.
BackendListenerImportsfromtheoldlocationsstillworks,butaredeprecated.
Addmopidy.
backend.
LibraryProvider.
browse(),whichcanbeimplementedbybackendsthatwantstoexposedirectoriesoftracksinMopidy'svirtuallesystem.
FrontendAPIThedummybackendusedfortestingmanyfrontendshavemovedfrommopidy.
backends.
dummytomopidy.
backend.
dummy.
(PR:#984)CommandsReduceamountofloggingfromdependencieswhenusingmopidy-v.
(Fixes:#593)Addsupportforadditionalloggingverbositylevelswithmopidy-vvandmopidy-vvvwhichincreasestheamountofloggingfromdependencies.
(Fixes:#593)CongurationThedefaultforthemopidy--configoptionhasbeenupdatedtoinclude$XDG_CONFIG_DIRSinaddi-tionto$XDG_CONFIG_DIR.
(Fixes#431)Addedsupportfordeprecatingcongvaluesinordertoallowforgracefulremovalofthenolongerusedcongvaluelocal/tag_cache_file.
ExtensionsupportSwitchedtousingaregistrymodelforclassesprovidedbyextension.
Thisallowsextensionstobeextendedbyotherextensions,asneededbyforexamplepluggablelibrariesforthelocalbackend.
Seemopidy.
ext.
Registryfordetails.
(Fixes#601)15.
3.
Changelog0.
xseries77MopidyDocumentation,Release3.
1.
1-1-gf17acacfAddedthenewmethodmopidy.
ext.
Extension.
setup().
Thismethodreplacesthenowdeprecatedget_backend_classes(),get_frontend_classes(),andregister_gstreamer_elements().
AudioAddedaudio/mixer_volumetosettheinitialvolumeofmixers.
Thisisespeciallyusefulforsettingthesoftwaremixervolumetosomethingelsethanthedefault100%.
(Fixes:#633)LocalbackendNote:AfterupgradingtoMopidy0.
18youmustrunmopidylocalscantoreindexyourlocalmusiccollection.
Thisisduetothechangeofstorageformat.
AddedsupportforbrowsinglocaldirectoriesinMopidy'svirtuallesystem.
Finishedtheworkoncreatingpluggablelibraries.
UserscannowrecongureMopidytousealternatelibraryprovidersoftheirchoosingforlocalles.
(Fixesissue#44,partiallyresolves#397,andcausesatemporaryregressionof#527.
)Switcheddefaultlocallibraryproviderfroma"tagcache"lethatcloselyresembledtheoneusedbytheoriginalMPDservertoacompressedJSONle.
Thisgreatlysimpliesourlibrarycodeandreusesourexistingmodelserializationcode,asusedbytheHTTPAPIandwebclients.
Removedouroutdatedandbug-ridden"tagcache"locallibraryimplementation.
Addedthecongvaluelocal/librarytoselectwhichlibrarytouse.
Itdefaultstojson,whichistheonlylocallibrarybundledwithMopidy.
Addedthecongvaluelocal/data_dirtohaveacommoncongforwheretostorelocallibrarydata.
Thisisintendedtoavoideverysinglelocallibraryproviderhavingtohaveit'sowncongvalueforthis.
Addedthecongvaluelocal/scan_flush_thresholdtocontrolhowoftentotelllocallibrariestostorechangeswhenscanninglocalmusic.
StreamingbackendAddlivelookupofURImetadata.
(Fixes#540)AddsupportforextendedM3Uplaylist,meaningthatbasictrackmetadatastoredinplaylistswillbeusedbyMopidy.
HTTPfrontendUpgradeMopidy.
jsdependenciesandaddsupportforusingMopidy.
jswithBrowserify.
ThisversionhasbeenreleasedtonpmasMopidy.
jsv0.
2.
0.
(Fixes:#609)MPDfrontendMakethelsinfo,listall,andlistallinfocommandssupportbrowsingofMopidy'svirtuallesys-tem.
(Fixes:#145)EmptycommandsnowreturnaACK[5@0]{}NocommandgivenerrorinsteadofOK.
Thisisconsis-tentwiththeoriginalMPDserverimplementation.
InternalchangesEventsfromtheaudioactor,backends,andcoreactorarenowemittedasyncronouslythroughtheGObjecteventloop.
ThisshouldresolvetheissuethathasblockedthemergeoftheEOT-vs-EOSxforalongtime.
78Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacf15.
3.
11v0.
17.
0(2013-11-23)Thefocusof0.
17hasbeenonintroducingsubcommandstothemopidycommand,makingitpossibleforextensionstoaddsubcommandsoftheirown,andtoimprovethedefaultconglewhenstartingMopidythersttime.
Inaddition,we'vegrownsupportforZeroconfpublishingoftheMPDandHTTPservers,andgottenamuchfasterscanner.
Thescannernowalsoscanssomeadditionaltagslikecomposersandperformers.
Sincethereleaseof0.
16,we'veclosedormerged22issuesandpullrequeststhroughabout200commitsbyvepeople,includingonenewcontributor.
CommandsSwitchedtosubcommandsforthemopidycommand,thisimpliesthefollowingchanges:(Fixes:#437)OldcommandNewcommandmopidy–show-depsmopidydepsmopidy–show-congmopidycongmopidy-scanmopidylocalscanAddedhooksforextensionstocreatetheirowncustomsubcommandsandconvertedmopidy-scanasarstuserofthenewAPI.
(Fixes:#436)CongurationWhenmopidyisstartedforthersttimewecreateanempty$XDG_CONFIG_DIR/mopidy/mopidy.
confle.
Wenowpopulatethislewiththedefaultcongforallinstalledextensionssoit'llbeeasiertosetupMopidywithoutlookingthroughallthedocumentationforrelevantcongvalues.
(Fixes:#467)CoreAPITheTrackmodelhasgrowneldsforcomposers,performers,genre,andcomment.
Thesearcheldtrackhasbeenrenamedtotrack_nametoavoidconfusionwithtrack_no.
(Fixes:#535)Thesignatureofthetracklist'sfilter()andremove()methodshavechanged.
Previously,theyex-pectede.
g.
tracklist.
filter(tlid=17).
Now,thevaluemustalwaysbealist,e.
g.
tracklist.
filter(tlid=[17]).
Thischangeallowsyoutogetorremovemultipletrackswithasinglecall,e.
g.
tracklist.
remove(tlid=[1,2,7]).
Thisisespeciallyusefulforwebclients,asrequestscanbebatched.
Thisalsobringstheinterfaceclosertothelibrary'sfind_exact()andsearch()methods.
AudioChangedefaultvolumemixerfromautoaudiomixertosoftware.
GStreamer1.
xdoesnotsupportvol-umecontrol,sowe'rechangingtousesoftwaremixingbydefault,asthatmaybetheonlythingwe'llsupportinthefuturewhenweupgradetoGStreamer1.
x.
LocalbackendLibraryscanninghasbeenswitchedbackfromGStreamer'sdiscoverertoourcustomimplementationduetovariousissueswithGStreamer0.
10'sbuiltinscanner.
Thisalsoxesthescannerslowdown.
(Fixes:#565)Whenscanning,wenolongerdefaultthealbumartisttobethesameasthetrackartist.
Albumartistisnowonlypopulatedifthescannedlegotanexplicitalbumartistset.
Thescannerwillnowextractmultipleartistsfromleswithmultipleartisttags.
Thescannerwillnowextractcomposersandperformers,aswellasgenre,bitrate,andcomments.
(Fixes:#577)Fixscannersothattimeoflastmodicationisrespectedwhendecidingwhichlescanbeskippedwhenscan-ningthemusiccollectionforchanges.
15.
3.
Changelog0.
xseries79MopidyDocumentation,Release3.
1.
1-1-gf17acacfThescannernowignoresthecapitalizationofleextensionsinlocal/excluded_file_extensions,soyounolongerneedtolistboth.
jpgand.
JPGtoignoreJPEGleswhenscanning.
(Fixes:#525)Thescannernowbydefaultignores*.
nfoand*.
htmllestoo.
MPDfrontendTheMPDserviceisnowpublishedasaZeroconfserviceifavahi-daemonisrunningonthesystem.
SomeMPDclientswillusethistopresentMopidyasanavailableserveronthelocalnetworkwithoutneedinganyconguration.
Seethempd/zeroconfcongvaluetochangetheservicenameordisabletheservice.
(Fixes:#39)Addsupportforcomposer,performer,comment,genre,andperformer.
Thesetagscanbeusedwithlist.
.
.
,search.
.
.
,andfind.
.
.
andtheirvariants,andaresupportedintheanytagalsoThebitrateeldinthestatusresponseisnowalwaysaninteger.
ThisfollowsthebehavioroftheoriginalMPDserver.
(Fixes:#577)HTTPfrontendTheHTTPserviceisnowpublishedasaZeroconfserviceifavahi-daemonisrunningonthesystem.
SomebrowserswillpresentHTTPZeroconfservicesonthelocalnetworkas"localsites"bookmarks.
Seethehttp/zeroconfcongvaluetochangetheservicenameordisabletheservice.
(Fixes:#39)DBUS/MPRISThemopidyprocessnowregistersit'sGObjecteventloopasthedefaulteventloopfordbus-python.
(Fixes:mopidy-mpris#2)15.
3.
12v0.
16.
1(2013-11-02)ThisisverysmallreleasetogetMopidy'sDebianpackagereadyforinclusioninDebian.
CommandsFixremovaloflastdirlevelinpathstodependenciesinmopidy--show-depsoutput.
Addmanpagesforallcommands.
LocalbackendFixsearchlteringbytracknumberthatwasaddedin0.
16.
0.
MPDfrontendAddsupportforlist"albumartist".
.
.
whichwasmissedwhenfindandsearchlearnedtohandlealbumartistin0.
16.
0.
(Fixes:#553)15.
3.
13v0.
16.
0(2013-10-27)Thegoalsfor0.
16weretoaddsupportforqueuingplaylistsofe.
g.
radiostreamsdirectlytoMopidy,withoutmanuallyextractingthestreamURLsfromtheplaylistrst,andtomovetheSpotify,Last.
fm,andMPRISsupportouttoindependentMopidyextensions,livingoutsidethemainMopidyrepo.
Inaddition,we'veseensomecleanuptotheplaybackvstracklistpartofthecoreAPI,whichwillrequiresomechangesforusersoftheHTTP/JavaScriptAPIs,aswellastheadditionofaudiomutingtothecoreAPI.
Tospeedupthedevelopmentofnewextensions,we'veaddedacookiecutterprojecttogettheskeletonofaMopidyextensionupandrunninginamatterofminutes.
Readbelowforallthedetailsandforlinkstoissueswithevenmoredetails.
Sincethereleaseof0.
15,we'veclosedormerged31issuesandpullrequeststhroughabout200commitsbyvepeople,includingthreenewcontributors.
80Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacfDependenciesPartsofMopidyhavebeenmovedtotheirownexternalextensions.
IfyouwantMopidytocontinuetoworklikeitusedto,youmayhavetoinstalloneormoreofthefollowingextensionsaswell:TheSpotifybackendhasbeenmovedtoMopidy-Spotify.
TheLast.
fmscrobblerhasbeenmovedtoMopidy-Scrobbler.
TheMPRISfrontendhasbeenmovedtoMopidy-MPRIS.
CorePartsofthefunctionalityinmopidy.
core.
PlaybackControllerhavebeenmovedtomopidy.
core.
TracklistController:OldlocationNewlocationplayback.
get_consume()tracklist.
get_consume()playback.
set_consume(v)tracklist.
set_consume(v)playback.
consumetracklist.
consumeplayback.
get_random()tracklist.
get_random()playback.
set_random(v)tracklist.
set_random(v)playback.
randomtracklist.
randomplayback.
get_repeat()tracklist.
get_repeat()playback.
set_repeat(v)tracklist.
set_repeat(v)playback.
repeattracklist.
repeatplayback.
get_single()tracklist.
get_single()playback.
set_single(v)tracklist.
set_single(v)playback.
singletracklist.
singleplayback.
get_tracklist_position()tracklist.
index(tl_track)playback.
tracklist_positiontracklist.
index(tl_track)playback.
get_tl_track_at_eot()tracklist.
eot_track(tl_track)playback.
tl_track_at_eottracklist.
eot_track(tl_track)playback.
get_tl_track_at_next()tracklist.
next_track(tl_track)playback.
tl_track_at_nexttracklist.
next_track(tl_track)playback.
get_tl_track_at_previous()tracklist.
previous_track(tl_track)playback.
tl_track_at_previoustracklist.
previous_track(tl_track)Thetl_trackargumenttothelastfournewfunctionsareusedasthereferencetl_trackinthetracklisttonde.
g.
thenexttrack.
Usually,thiswillbecurrent_tl_track.
Addedmopidy.
core.
PlaybackController.
muteformutingandunmutingaudio.
(Fixes:#186)Addedmopidy.
core.
CoreListener.
mute_changed()eventthatistriggeredwhenthemutestatechanges.
In"random"mode,afterafullplaythroughofthetracklist,playbackcontinuedfromthelasttrackplayedtotheendoftheplaylistinnon-randomorder.
Itnowstopswhenalltrackshavebeenplayedonce,unless"repeat"modeisenabled.
(Fixes:#453)In"single"mode,afteratrackended,playbackcontinuedwiththenexttrackinthetracklist.
Itnowstopsafterplayingasingletrack,unless"repeat"modeisenabled.
(Fixes:#496)AudioAddedsupportforparsingandplaybackofplaylistsinGStreamer.
ForendusersthisbasicallymeansthatyoucannowaddaradioplaylisttoMopidyandwewillautomaticallydownloaditandplaythestreaminsideit.
CurrentlywesupportM3U,PLS,XSPFandASXles.
Alsonotethatwecancurrentlyonlyplaytherststreamintheplaylist.
15.
3.
Changelog0.
xseries81MopidyDocumentation,Release3.
1.
1-1-gf17acacfWenowhandletherarecasewhereanaudiotrackhasmaxvolumeequaltomin.
Thiswascausingdividebyzeroerrorswhenscalingvolumestoazerotohundredscale.
(Fixes:#525)Addedsupportformutingaudiowithoutsettingthevolumeto0.
Thisworksbothforthesoftwareandhardwaremixers.
(Fixes:#186)LocalbackendReplacedourcustommedialibraryscannerwithGStreamer'sbuiltinscanner.
Thisshouldmakescanninglesserrorproneandfasterastimeoutsshouldbeinfrequent.
(Fixes:#198)Medialeswithlessthan100msdurationarenowexcludedfromthelibrary.
Medialeswiththeleextensions.
jpeg,.
jpg,.
png,.
txt,and.
logarenowskippedbythemedialibraryscanner.
Youcanchangethelistofexcludedleextensionsbysettingthelocal/excluded_file_extensionscongvalue.
(Fixes:#516)UnknownURIsfoundinplaylistsarenowmadeintotrackobjectswiththeURIsetinsteadofbeingignored.
Thismakesitpossibletohaveplaylistswithe.
g.
HTTPradiostreamsandnotjustlocal:track:.
.
.
URIs.
Thisusedtowork,butwasbrokeninMopidy0.
15.
0.
(Fixes:#527)Fixedcrashwhenplayinglocal:track:.
.
.
URIswhichcontainednon-ASCIIcharsafteruridecode.
Removedmedialesarenowalsoremovedfromthein-memorymedialibrarywhenthemedialibraryisreloadedfromdisk.
(Fixes:#500)MPDfrontendMadetheformerlyunusedcommandsoutputs,enableoutput,anddisableoutputmute/unmuteau-dio.
(Relatedto:#186)TheMPDcommandlistnowworkswith"albumartist"asitssecondargument,e.
g.
list"album""albumartist""anartist".
(Fixes:#468)TheMPDcommandsfindandsearchnowacceptsalbumartistandtrack(thisisthetracknumber,notthetrackname)aseldtypestolimitthesearchresultwith.
TheMPDcommandcountisnowimplemented.
Itacceptsthesametypeofargumentsasfindandsearch,butreturnsthenumberoftracksandtheirtotalplaytimeinstead.
ExtensionsupportAcookiecutterprojectforquicklycreatingnewMopidyextensionshavebeencreated.
Youcannditatcookiecutter-mopidy-ext.
(Fixes:#522)15.
3.
14v0.
15.
0(2013-09-19)Areleasewithanumberofsmallandmediumxes,withnospecicfocus.
DependenciesMopidynolongersupportsPython2.
6.
Currently,theonlyPythonversionsupportedbyMopidyisPython2.
7.
We'recontinuouslyworkingtowardsrunningMopidyonPython3.
(Fixes:#344)CommandlineoptionsConvertedfromtheoptparsetotheargparselibraryforhandlingcommandlineoptions.
mopidy--show-configwillnowtakeintoconsiderationanymopidy--optionargumentsappearinglateronthecommandline.
Thishelpsyouseetheeffectivecongurationforrunswiththesamemopidy--optionsarguments.
Audio82Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacfAddedsupportforaudiovisualization.
audio/visualizercannowbesettoGStreamervisualizers.
Properlyencodelocalizedmixernamesbeforelogging.
LocalbackendAnalbum'snumberofdiscsandatrack'sdiscnumberarenowextractedwhenscanningyourmusiccollection.
Thescannernowgivesupscanningaleafterasecond,andcontinueswiththenextle.
Thisxessomehangsonnon-mediales,likelogs.
(Fixes:#476,#483)Addedsupportforpluggablelibraryupdaters.
Thisallowsextensionwriterstostartprovidingtheirowncustomlibrariesinsteadofbeingstuckwithjustourtagcacheastheonlyoption.
Convertedlocalbackendtousenewlocal:playlist:pathandlocal:track:pathURIscheme.
Alsomovessupportoffile://tostreamingbackend.
SpotifybackendPrependplaylistfoldernamestotheplaylistname,sothattheplaylisthierarchyfromyourSpotifyaccountisavailableinMopidy.
(Fixes:#62)Fixproxycongvaluesthatwasbrokenwiththecongsystemchangein0.
14.
(Fixes:#472)MPDfrontendReplacenewline,carriagereturnandforwardslashinplaylistnames.
(Fixes:#474,#480)AcceptlistallandlistallinfocommandswithouttheURIparameter.
Themethodsarestillnotimple-mented,butnowthecommandsareacceptedasvalid.
HTTPfrontendFixtoobroadtruthtestthatcausedmopidy.
models.
TlTrackobjectswithtlidsetto0tobesenttotheHTTPclientwithoutthetlideld.
(Fixes:#501)UpgradeMopidy.
jsdependencies.
ThisversionhasbeenreleasedtonpmasMopidy.
jsv0.
1.
1.
Extensionsupportmopidy.
config.
Secretisnowdeserializedtounicodeinsteadofbytes.
Thismayrequiremodicationstoextensions.
15.
3.
15v0.
14.
2(2013-07-01)ThisisamaintenancereleasetomakeMopidy0.
14workwithpyspotify1.
11.
Dependenciespyspotify>=1.
9,=1.
1isnowrequired.
CoreRemovedthemopidy.
settings.
DEBUG_THREADsettingandthemopidy--debug-threadcom-mandlineoption.
SendingSIGUSR1totheMopidyprocesswillnowalwaysmakeitlogtracebacksforallalivethreads.
Logawarningifatrackisn'tplayabletomakeitmoreobviousthatbackendXneedsbackendYtobepresentforplaybacktowork.
mopidy.
core.
TracklistController.
add()nowacceptsanuriwhichitwilllookupinthelibraryandthenaddtothetracklist.
Thisishelpfulfore.
g.
webclientsthatdoesn'twanttotransferalltrackmetadatabacktotheserverjusttoaddittothetracklistwhentheserveralreadygotalltheneededinformationeasilyavailable.
(Fixes:#325)Changethefollowingmethodstoacceptanuriskeywordargument:–mopidy.
core.
LibraryController.
find_exact()–mopidy.
core.
LibraryController.
search()SearchquerieswillonlybeforwardedtobackendshandlingthegivenURIroots,andthebackendsmayusetheURIrootstofurtherlimitwhatresultsarereturned.
Forexample,asearchwithuris=['file:']willonlybeprocessedbythelocalbackend.
Asearchwithuris=['file:///media/music']willonlybeprocessedbythelocalbackend,and,ifsuchlteringissupportedbythebackend,willonlyreturnresultswithURIswithinthegivenURIroot.
15.
3.
Changelog0.
xseries85MopidyDocumentation,Release3.
1.
1-1-gf17acacfAudiosub-systemMakeaudioerrorlogginghandlelogmessageswithnon-ASCIIchars.
(Fixes:#347)LocalbackendMakemopidy-scanworkwithOggVorbisles.
(Fixes:#275)Fixplaybackofleswithnon-ASCIIcharsintheirlepath.
(Fixes:#353)SpotifybackendLetGStreamerhandletimepositiontrackingandseeks.
(Fixes:#191)ForallplaylistsownedbyotherSpotifyusers,wenowappendtheowner'susernametotheplaylistname.
(Partlyxes:#114)HTTPfrontendMopidy.
jsnowworksbothfrombrowsersandfromNode.
jsenvironments.
ThismeansthatyounowcanmakeMopidyclientsinNode.
js.
Mopidy.
jshasbeenpublishedtothenpmregistryforeasyinstallationinNode.
jsprojects.
UpgradeMopidy.
js'buildsystemGruntfrom0.
3to0.
4.
UpgradeMopidy.
js'dependencieswhen.
jsfrom1.
6.
1to2.
0.
0.
Exposemopidy.
core.
Core.
get_uri_schemes()toHTTPclients.
ItisavailablethroughMopidy.
jsasmopidy.
getUriSchemes().
MPRISfrontendPublishalbumartURIsifavailable.
Publishdiscnumberoftrackifavailable.
15.
3.
19v0.
12.
0(2013-03-12)The0.
12releasehasbeendelayedforawhilebecauseofsomeissuesrelatedsomeongoingGStreamercleanupwedidn'tinvestenoughtimetonish.
Finally,we'vecometooursensesandhavenowcherry-pickedthegoodpartstobringyouanewrelease,whilepostponingtheGStreamerchangesto0.
13.
Thereleaseaddsanewbackendforplayingaudiostreams,aswellasvariousminorimprovementsthroughoutMopidy.
MakeMopidyworkonearlyPython2.
6versions.
(Fixes:#302)–optparsefailsiftherstargumenttoadd_optionisaunicodestringonPython=1.
9,=1.
9,=1.
9.
SubscriptionstootherSpotifyuser's"starred"playlistsareignored,astheycurrentlyisn'tfullysupportedbypyspotify.
Localbackend#236:Themopidy-scancommandfailedtoincludetagsfromALACles(Applelossless)becauseitdidn'tsupportmultipletagmessagesfromGStreamerpertrackitscanned.
Addedsupportforsearchbylenametolocalbackend.
MPDfrontend#218:TheMPDcommandslistplaylistandlistplaylistinfonowacceptsunquotedplaylistnamesiftheydon'tcontainspaces.
#246:TheMPDcommandlistalbumartist""andsimilarsearch,find,andlistcommandswithemptyltervaluescausedaLookupError,butshouldhavebeenignoredbytheMPDserver.
TheMPDfrontendnolongerlowercasessearchqueries.
Thisbrokee.
g.
searchbyURI,wherecasingmaybeessential.
TheMPDcommandplchangesalwaysreturnedtheentireplaylist.
Itnowreturnsanemptyresponsewhentheclienthasseenthelatestversion.
TheMPDcommandssearchandfindnowallowsthekeyfile,whichisusedbyncmpcppinsteadoffilename.
TheMPDcommandssearchandfindnowallowsearchqueryvaluestobeemptystrings.
TheMPDcommandlistplaylistswillnolongerreturnplaylistswithoutaname.
Thiscouldcrashncm-pcpp.
TheMPDcommandlistwillnolongerreturnartistnames,albumnames,ordatesthatareblank.
TheMPDcommanddecoderswillnowreturnanemptyresponseinsteadofa"notimplemented"errortomakethencmpcppbrowseviewworkthersttimeitisopened.
MPRISfrontendTheMPRISplaylistsinterfaceisnowsupportedbyourMPRISfrontend.
ThismeansthatyounowcanselectplayliststoqueueandplayfromtheUbuntuSoundMenu.
90Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacfAudiomixersMadetheNADmixerresponsivetointerruptsduringampliercalibration.
Itwillnowquitimmediately,whilepreviouslyitcompletedthecalibrationrst,andthenquit,whichcouldtakemorethan15seconds.
DevelopersupportAddedoptionalbackgroundthreadfordebuggingdeadlocks.
Whenthefeatureisenabledviathemopidy--debug-threadoptionormopidy.
settings.
DEBUG_THREADsettingaSIGUSR1signalwilldumpthetracebackforallrunningthreads.
ThesettingsvalidatorwillnowallowanysettingprexedwithCUSTOM_toexistinthesettingsle.
InternalchangesInternally,MopidyhaveseenalotofchangestopavethewayformultiplebackendsandthefutureHTTPfrontend.
Anewlayerandactor,"core",hasbeenaddedtoourstack,inbetweenthefrontendsandthebackends.
Theresponsibilityofthecorelayerandactoristotakerequestsfromthefrontends,passthemontooneormorebackends,andcombiningtheresponsefromthebackendsintoasingleresponsetotherequestingfrontend.
Frontendsnolongerknowanythingaboutthebackends.
Theyjustusethemopidy.
core—CoreAPI.
Thedependencygraphbetweenthecorecontrollersandthebackendprovidershavebeenstraightenedout,sothatwedon'thaveanycirculardependencies.
Thefrontend,core,backend,andaudiolayersarenowstrictlyseparate.
Thefrontendlayercallsonthecorelayer,andthecorelayercallsonthebackendlayer.
Boththecorelayerandthebackendsareallowedtocallontheaudiolayer.
Anydataowintheoppositedirectionisdonebybroadcastingofeventstolisteners,throughe.
g.
mopidy.
core.
CoreListenerandmopidy.
audio.
AudioListener.
SeeArchitectureformoredetailsandillustrationsofalltherelations.
Alldependenciesarenowexplicitlypassedtotheconstructorsofthefrontends,core,andthebackends.
Thismakestestingeachlayerwithdummy/mockedlowerlayerseasierthanwiththeoldvariant,wheredependencieswherelookedupinPykka'sactorregistry.
AllpropertiesinthecoreAPInowgotgetters,andsettersifsettingthemisallowed.
Theyarenotexplictlylistedinthedocsastheyhavethesamebehaviorasthedocumentedproperties,buttheyareavailableandmaybeused.
ThisisusefulforthefutureHTTPfrontend.
Models:Addedmopidy.
models.
Album.
dateattribute.
Ithasthesameformatastheexistingmopidy.
models.
Track.
date.
Addedmopidy.
models.
ModelJSONEncoderandmopidy.
models.
model_json_decoder()forautomaticJSONserializationanddeserializationofdatastructureswhichcontainsMopidymodels.
ThisisusefulforthefutureHTTPfrontend.
Library:mopidy.
core.
LibraryController.
find_exact()andmopidy.
core.
LibraryController.
search()nowreturnsplainlistsoftracksinsteadofplaylistobjects.
mopidy.
core.
LibraryController.
lookup()nowreturnsalistoftracksinsteadofasingletrack.
ThismakesitpossibletosupportlookupofartistoralbumURIswhichthencanexpandtoalistoftracks.
Playback:Thebaseplaybackproviderhasbeenupdatedwithsanedefaultbehaviorinsteadofemptyfunctions.
Bydefault,theplaybackprovidernowletsGStreamerkeeptrackofthecurrenttrack'stimeposition.
Thelocalbackendsimplyusesthebaseplaybackproviderwithoutanychanges.
AnyfuturebackendthatjustfeedsURIstoGStreamertoplaycanalsousethebaseplaybackproviderwithoutanychanges.
15.
3.
Changelog0.
xseries91MopidyDocumentation,Release3.
1.
1-1-gf17acacfRemovedmopidy.
core.
PlaybackController.
track_at_previous.
Usemopidy.
core.
PlaybackController.
tl_track_at_previousinstead.
Removedmopidy.
core.
PlaybackController.
track_at_next.
Usemopidy.
core.
PlaybackController.
tl_track_at_nextinstead.
Removedmopidy.
core.
PlaybackController.
track_at_eot.
Usemopidy.
core.
PlaybackController.
tl_track_at_eotinstead.
Removedmopidy.
core.
PlaybackController.
current_tlid.
Usemopidy.
core.
PlaybackController.
current_tl_trackinstead.
Playlists:TheplaylistspartofthecoreAPIhasbeenrevisedtobemorefocusedaroundtheplaylistURI,andsomeredundantfunctionalityhasbeenremoved:Renamed"storedplaylists"to"playlists"everywhere,includingthecoreAPIusedbyfrontends.
mopidy.
core.
PlaylistsController.
playlistsnolongersupportsassignmenttoit.
Theplaylistspropertyonthebackendlayerstilldoes,andallfunctionalityismaintainedbyassigningtotheplaylistscollec-tionsatthebackendlevel.
mopidy.
core.
PlaylistsController.
delete()nowacceptsanURI,andnotaplaylistobject.
mopidy.
core.
PlaylistsController.
save()nowreturnsthesavedplaylist.
Thereturnedplaylistmaydifferfromthesavedplaylist,andshouldthusbeusedinsteadoftheplaylistpassedtomopidy.
core.
PlaylistsController.
save().
mopidy.
core.
PlaylistsController.
rename()hasbeenremoved,sincerenamingcanbedonewithmopidy.
core.
PlaylistsController.
save().
mopidy.
core.
PlaylistsController.
get()hasbeenreplacedbymopidy.
core.
PlaylistsController.
filter().
Theeventmopidy.
core.
CoreListener.
playlist_changed()hasbeenchangedtoincludetheplaylistthatwaschanged.
Tracklist:Renamed"currentplaylist"to"tracklist"everywhere,includingthecoreAPIusedbyfrontends.
Removedmopidy.
core.
TracklistController.
append().
Usemopidy.
core.
TracklistController.
add()instead,whichisnowcapableofaddingmultipletracks.
mopidy.
core.
TracklistController.
get()hasbeenreplacedbymopidy.
core.
TracklistController.
filter().
mopidy.
core.
TracklistController.
remove()cannowremovemultipletracks,andreturnsthetracksitremoved.
Whenthetracklistischanged,wenowtriggerthenewmopidy.
core.
CoreListener.
tracklist_changed()event.
Previouslywetriggeredmopidy.
core.
CoreListener.
playlist_changed(),whichisintendedforstoredplaylists,notthetracklist.
TowardsPython3support:Maketheentirecodebaseuseunicodestringsbydefault,andonlyfallbacktobytestringswhereitisrequired.
AnotherstepclosertoPython3.
92Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacf15.
3.
24v0.
8.
1(2012-10-30)Asmallmaintenancereleasetoxabugintroducedin0.
8.
0andupdateMopidytoworkwithPykka1.
0.
DependenciesPykka>=1.
0isnowrequired.
Bugxes#213:Fix"streamingtaskpaused,reasonnot-negotiated"errorsobservedbysomeusersonsomeSpotifytracksduetoachangeintroducedin0.
8.
0.
Seetheissueforapatchthatappliesto0.
8.
0.
#216:VolumereturnedbytheMPDcommandstatuscontainedaoatingpoint.
0sufx.
Thisbugwasintro-ducedwiththelargeaudiooutputandmixerchangesinv0.
8.
0andbroketheMPDroidAndroidclient.
Itnowreturnsanintegeragain.
15.
3.
25v0.
8.
0(2012-09-20)Thisreleasedoesnotincludeanymajornewfeatures.
We'vedoneamajorcleanupofhowaudiooutputsandaudiomixerswork,andonthewaywe'veresolvedabunchofrelatedissues.
AudiooutputandmixerchangesRemovedmultipleoutputssupport.
Havingthisfeaturecurrentlyseemstobemoretroublethanwhatitisworth.
Themopidy.
settings.
OUTPUTSsettingisnolongersupported,andhasbeenreplacedwithmopidy.
settings.
OUTPUTwhichisaGStreamerbindescriptionstringinthesameformatasgst-launchexpects.
Defaultvalueisautoaudiosink.
(Fixes:#81,#115,#121,#159)SwitchtopureGStreamerbasedmixing.
ThisimpliesthatuserssetupaGStreamerbinwithamixerinitinmopidy.
settings.
MIXER.
Thedefaultvalueisautoaudiomixer,acustommixerthatattemptstondamixerthatwillworkonyoursystem.
Ifthispicksthewrongmixeryoucanofcourseoverrideit.
SettingthemixertoNoneisalsosupported.
MPDprotocolsupportforvolumehasalsobeenupdatedtoreturn-1whenwehavenomixerset.
softwarecanbeusedtoforcesoftwaremixing.
RemovedtheDenonhardwaremixer,asitisnotmaintained.
UpdatedtheNADhardwaremixertoworkinthenewGStreamerbasedmixingregime.
SettingsarenowpassedasGStreamerelementproperties.
Inpracticethatmeansthatthefollowingold-stylecong:MIXER=u'mopidy.
mixers.
nad.
NadMixer'MIXER_EXT_PORT=u'/dev/ttyUSB0'MIXER_EXT_SOURCE=u'Aux'MIXER_EXT_SPEAKERS_A=u'On'MIXER_EXT_SPEAKERS_B=u'Off'Nowisreducedtosimply:MIXER=u'nadmixerport=/dev/ttyUSB0source=auxspeakers-a=onspeakers-b=off'Theportpropertydefaultsto/dev/ttyUSB0,andtherestofthepropertiesmaybeleftoutifyoudon'twantthemixertoadjustthesettingsonyourNADamplierwhenMopidyisstarted.
ChangesWhenunknownsettingsareencountered,wenowcheckifit'ssimilartoaknownsetting,andsuggeststotheuserwhatwethinkthesettingshouldhavebeen.
Addedmopidy--list-depsoptionthatlistsrequiredandoptionaldependencies,theircurrentversions,andsomeotherinformationusefulfordebugging.
(Fixes:#74)15.
3.
Changelog0.
xseries93MopidyDocumentation,Release3.
1.
1-1-gf17acacfAddedtools/debug-proxy.
pytoteeclientrequeststotwobackendsanddiffresponses.
IntendedasadevelopertoolforcheckingforMPDprotocolchangesandvariousclientsupport.
Requiresgevent,whichcurrentlyisnotadependencyofMopidy.
Supporttrackswithonlyreleaseyear,andnotafullreleasedate,likee.
g.
Spotifytracks.
DefaultvalueofLOCAL_MUSIC_PATHhasbeenupdatedtobe$XDG_MUSIC_DIR,whichonmostsystemsthisissetto$HOME.
Usersoflocalbackendthatreliedontheolddefault~/musicneedtoupdatetheirsettings.
NotethatthecoderesponsibleforndingthismusicnowalsoignoresUNIXhiddenlesandfolders.
Fileandpathsettingsnowsupport$XDG_CACHE_DIR,$XDG_DATA_DIRand$XDG_MUSIC_DIRsubsti-tution.
Defaultsforsuchsettingshavebeenupdatedtousethisinsteadofhiddenawaydefaults.
Playbackisnowdoneusingplaybin2fromGStreamerinsteadofrollingourown.
Thisistherststeptowardsresolving#171.
Bugxes#72:CreatedaSpotifytrackproxythatwillswitchtousingloadeddataassoonasitbecomesavailable.
#150:FixbugwhichcausedsomeclientstoblockMopidycompletely.
Thebugwascausedbysomeclientssendingcloseandthenshuttingdowntheconnectionrightaway.
Thistriggedasituationinwhichtheconnec-tioncleanupcodewouldwaitforanresponsethatwouldnevercomeinsidetheeventloop,blockingeverythingelse.
#162:FixedbugwhentheMPDcommandplaylistinfoisusedwithatrackposition.
TrackpositionandCPIDwasintermixed,soitwouldcauseacrashifaCPIDmatchingthetrackpositiondidn'texist.
Fixedcrashonlookupofunknownpathwhenusinglocalbackend.
#189:LOCAL_MUSIC_PATHandpathhandlinginrestofsettingshasbeenupdatedsoallofthecodenowusesthecorrectvalue.
FixedincorrecttrackURIsgeneratedbyM3Uplaylistparsingcode.
GeneratedtracksarenowrelativetoLOCAL_MUSIC_PATH.
#203:Re-addsupportforsoftwaremixing.
15.
3.
26v0.
7.
3(2012-08-11)Asmallmaintenancereleasetoxacrashaffectingafewusers,andacoupleofsmalladjustmentstotheSpotifybackend.
ChangesFixedcrashwhenloggingIOErrorexceptionsonsystemsusinglanguageswithnon-ASCIIcharacters,likeFrench.
MovethedefaultlocationoftheSpotifycachefrom~/.
cache/mopidyto~/.
cache/mopidy/spotify.
Youcanchangethisbysettingmopidy.
settings.
SPOTIFY_CACHE_PATH.
ReducetimerequiredtoupdatetheSpotifycacheonstartup.
Oneonesystem/Spotifyaccount,thetimefromcleancachetoreadyforusewasreducedfrom35sto12s.
94Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacf15.
3.
27v0.
7.
2(2012-05-07)ThisisamaintenancereleasetomakeMopidy0.
7buildonsystemswithoutallofMopidy'sruntimedependencies,likeLaunchpadPPAs.
ChangesChangefromversiontupleatmopidy.
VERSIONtoPEP386compliantversionstringatmopidy.
__version__toconformtoPEP396.
15.
3.
28v0.
7.
1(2012-04-22)ThisisamaintenancereleasetomakeMopidy0.
7workwithpyspotify>=1.
7.
ChangesDon'toverridepyspotify'snotify_main_threadcallback.
Thedefaultimplementationissensible,whileouroverridedidnothing.
15.
3.
29v0.
7.
0(2012-02-25)Notabigreleasewithregardtofeatures,butthisreleasegotsomeperformanceimprovementsoverv0.
6,especiallyforslowerAtomsystems.
Italsoxesacoupleofotherbugs,includingonewhichmadeMopidycrashwhenusingGStreamerfromtheprereleasesofUbuntu12.
04.
ChangesTheMPDcommandplaylistinfoisnowfaster,thankstoJohnBckstrand.
Addedthemethodmopidy.
backends.
base.
CurrentPlaylistController.
length(),mopidy.
backends.
base.
CurrentPlaylistController.
index(),andmopidy.
backends.
base.
CurrentPlaylistController.
slice()toreducetheneedforcopyingtheentirecurrentplaylistfromonethreadtoanother.
ThankstoJohnBckstrandforpinpointingtheissue.
Fixcrashoncreationofcongandcachedirectoriesifintermediatedirectoriesdoesnotexist.
Thiswasespe-ciallythecaseonOSX,where~/.
configdoesn'texistformostusers.
Fixgst.
LinkErrorwhichappearedwhenusingnewerversionsofGStreamer,e.
g.
onUbuntu12.
04Alpha.
(Fixes:#144)FixcrashonmismatchingquotationinlistMPDqueries.
(Fixes:#137)Volumeisnowreportedtobethesameasthevolumewassetto,alsowheninternalroundinghavebeendoneduetomopidy.
settings.
MIXER_MAX_VOLUMEhasbeensettocapthevolume.
Thisshouldmakeitpossibletomanagecappedvolumefromclientsthatonlyincreasevolumewithonestepatatime,likencmpcppdoes.
15.
3.
30v0.
6.
1(2011-12-28)ThisisamaintenancereleasetomakeMopidy0.
6workwithpyspotify>=1.
5,whichMopidy'sdevelopbranchhavesupportedforalongtime.
ThisshouldalsomaketheDebianpackagesworkoutoftheboxagain.
Importantchangespyspotify1.
5orgreaterisrequired.
ChangesSpotifyplaylistfolderboundariesarenowproperlydetected.
Inotherwords,ifyouuseplaylistfolders,youwillnolongergetlotsoflogmessagesaboutbadplaylists.
15.
3.
Changelog0.
xseries95MopidyDocumentation,Release3.
1.
1-1-gf17acacf15.
3.
31v0.
6.
0(2011-10-09)ThedevelopmentofMopidyhavebeenquiteslowforthelastcoupleofmonths,butwedohavesomegoodiestoreleasewhichhavebeenidlinginthedevelopbranchsincethewarmerdaysofthesummer.
ThisreleasebringssupportfortheMPDidlecommand,whichmakesitpossibleforaclientwaitforupdatesfromtheserverinsteadofpollingeverysecond.
Also,we'veaddedsupportfortheMPRISstandard,sothatMopidycanbecontrolledoverD-Busfrome.
g.
theUbuntuSoundMenu.
Pleasenotethat0.
6.
0requiressomeupdateddependencies,aslistedunderImportantchangesbelow.
ImportantchangesPykka0.
12.
3orgreaterisrequired.
pyspotify1.
4orgreaterisrequired.
Allcong,data,andcachelocationsarenowbasedontheXDGspec.
–Thismeansthatyoursettingslewillneedtobemovedfrom~/.
mopidy/settings.
pyto~/.
config/mopidy/settings.
py.
–YourSpotifycachewillnowbestoredin~/.
cache/mopidyinsteadof~/.
mopidy/spotify_cache.
–Thelocalbackend'stag_cacheshouldnowbein~/.
local/share/mopidy/tag_cache,like-wiseyourplaylistswillbein~/.
local/share/mopidy/playlists.
–ThelocalclientnowtriestolookupwhereyourmusicisviaXDG,itwillfall-backto~/musicorusewhateversettingyousetmanually.
TheMPDcommandidleisnowsupportedbyMopidyforthefollowingsubsystems:player,playlist,options,andmixer.
(Fixes:#32)Anewfrontendmopidy.
frontends.
mprishavebeenadded.
ItexposesMopidythroughtheMPRISinterfaceoverD-Bus.
Inpractice,thismakesitpossibletocontrolMopidythroughtheUbuntuSoundMenu.
ChangesReplacemopidy.
backends.
base.
Backend.
uri_handlerswithmopidy.
backends.
base.
Backend.
uri_schemes,whichjusttakesthepartuptothecolonofanURI,andnotanyprex.
AddListenerAPI,mopidy.
listeners,tobeimplementedbyactorswantingtoreceiveeventsfromthebackend.
ThisisaformalizationoftheadhoceventstheLast.
fmscrobblerhasalreadybeenusingforsometime.
ReplacedalloftheMPDnetworkcodethatwasprovidedbyasyncorewithcustomstack.
Thischangewasmadetofacilitatesupportfortheidlecommand,andtoreducethenumberofeventloopsbeingused.
FixmetadataupdateinShoutcaststreaming.
(Fixes:#122)UnescapeallincomingMPDrequests.
(Fixes:#113)IncreasethemaximumnumberofresultsreturnedbySpotifysearchesfrom32to100.
SendSpotifysearchqueriestopyspotifyasunicodeobjects,asrequiredbypyspotify1.
4.
(Fixes:#129)Addsettingmopidy.
settings.
MPD_SERVER_MAX_CONNECTIONS.
(Fixes:#134)Removedestroy()methodsfrombackendcontrollerandproviderAPIs,asitwasnotinuseandactuallynotcalledbyanycode.
Willreintroducewhenneeded.
96Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacf15.
3.
32v0.
5.
0(2011-06-15)Sincelasttimewe'veaddedsupportforaudiostreamingtoSHOUTcastserversandxedthelongstandingplaylistloadingissueintheSpotifybackend.
Asalwaysthereleasehasabunchofbugxesandminorimprovements.
Pleasenotethat0.
5.
0requiressomeupdateddependencies,aslistedunderImportantchangesbelow.
ImportantchangesIfyouusetheSpotifybackend,youmustupgradetolibspotify0.
0.
8andpyspotify1.
3.
IfyouinstallfromAPT,libspotifyandpyspotifywillautomaticallybeupgraded.
IfyouarenotinstallingfromAPT,followtheinstructionsatInstallation.
Ifyouhaveexplicitlysetthemopidy.
settings.
SPOTIFY_HIGH_BITRATEsetting,youmustupdateyoursettingsle.
Thenewsettingisnamedmopidy.
settings.
SPOTIFY_BITRATEandacceptstheintegervalues96,160,and320.
Mopidynowsupportsrunningwith1toNoutputsatthesametime.
ThisfeaturewasmainlyaddedtofacilitateSHOUTcastsupport,whichMopidyhasalsogained.
Initscurrentstateoutputscannotbetoggledduringruntime.
ChangesLocalbackend:–Fixlocalbackendtimequeryerrorsthatwherecomingfromstoppedpipeline.
(Fixes:#87)Spotifybackend:–ThankstoAntoinePierlot-Garcin'srecentworkonupdatingandimprovingpyspotify,storedplaylistswillagainloadwhenMopidystarts.
Theworkaroundofsearchingandreconnectingtomaketheplaylistsappeararenolongernecessary.
(Fixes:#59)–Track'sthatarenolongeravailableinSpotify'sarchivesarenow"autolinked"tocorrespondingtracksinotheralbums,justliketheofcialSpotifyclientsdo.
(Fixes:#34)MPDfrontend:–Refactoringandcleanup.
Mostnotably,allrequesthandlersnowgetaninstanceofmopidy.
frontends.
mpd.
dispatcher.
MpdContextastherstargument.
Thenewclasscontainsref-erencetoanyobjectinMopidytheMPDprotocolimplementationshouldneedaccessto.
–Closetheclientconnectionwhenthecommandcloseisreceived.
–Donotallowaccesstothecommandkill.
–commandsandnotcommandsnowhavecorrectoutputifpasswordauthenticationisturnedon,buttheconnecteduserhasnotbeenauthenticatedyet.
Commandlineusage:–SupportpassingoptionstoGStreamer.
Seemopidy--help-gstforalistofavailableoptions.
(Fixes:#95)–Improvemopidy--list-settingsoutput.
(Fixes:#91)–Addedmopidy--interactiveforreadingmissinglocalsettingsfromstdin.
(Fixes:#96)–ImproveshutdownprocedureatCTRL+C.
AddsignalhandlerforSIGTERM,whichinitiatesthesameshutdownprocedureasCTRL+Cdoes.
Tagcachegenerator:–Madeitpossibletoabortmopidy-scanwithCTRL+C.
–Fixedbugregardinghandlingofbaddates.
15.
3.
Changelog0.
xseries97MopidyDocumentation,Release3.
1.
1-1-gf17acacf–Uselogginginsteadofprintstatements.
–FoundandworkedaroundstrangeWMAmetadatabehaviour.
BackendAPI:–Callingonmopidy.
backends.
base.
playback.
PlaybackController.
next()andmopidy.
backends.
base.
playback.
PlaybackController.
previous()nolongerim-pliesthatplaybackshouldbestarted.
Theplaybackstate–whetherplaying,pausedorstopped–willnowbekept.
–Themethodmopidy.
backends.
base.
playback.
PlaybackController.
change_track()hasbeenadded.
Likenext(),andprev(),itchangesthecurrenttrackwithoutchangingtheplaybackstate.
15.
3.
33v0.
4.
1(2011-05-06)ThisisabugxreleasexingaudioproblemsonolderGStreamerandsomeminorbugs.
BugxesFixbrokenaudioonatleastGStreamer0.
10.
30,whichaffectsUbuntu10.
10.
TheGStreamerappsrcbinwasn'tbeinglinkedduetolackofdefaultcaps.
(Fixes:#85)Fixcrashinmopidy.
mixers.
nadthatoccuresatstartupwhentheiomoduleisavailable.
Weusedaneolkeywordargumentwhichissupportedbyserial.
FileLike.
readline(),butnotbyio.
RawBaseIO.
readline().
Whentheiomoduleisavailable,itisusedbyPySerialinsteadoftheFileLikeimplementation.
FixUnicodeDecodeErrorinMPDfrontendonnon-englishlocale.
ThankstoAntoinePierlot-Garcinforthepatch.
(Fixes:#88)DonotcreatePykkaproxiesthatarenotgoingtobeusedinmopidy.
core.
Theunderlyingactormayalreadyintentionallybedead,andthustheprogrammaycrashoncreatingaproxyitdoesn'tneed.
CombinedwiththePykka0.
12.
2releasethisxesacrashintheLast.
fmfrontendwhichmayoccurwhenalldependenciesareinstalled,butthefrontendisn'tcongured.
(Fixes:#84)15.
3.
34v0.
4.
0(2011-04-27)Mopidy0.
4.
0isanotherreleasewithoutmajorfeatureadditions.
In0.
4.
0we'vexedabunchofissuesandbugs,withthehelpofseveralnewcontributorswhoarecreditedinthechangelogbelow.
Themajorchangeof0.
4.
0isaninternalrefactoringwhichclearswayforfuturefeatures,andwhichalsomakeMopidyworkonPython2.
7.
Inotherwords,Mopidy0.
4.
0worksonUbuntu11.
04andArchLinux.
Pleasenotethat0.
4.
0requiressomeupdateddependencies,aslistedunderImportantchangesbelow.
Also,theknownbugintheSpotifyplaylistloadingfromMopidy0.
3.
0isstillpresent.
Warning:KnownbuginSpotifyplaylistloadingThereisaknownbugintheloadingofSpotifyplaylists.
Toavoidthebug,followthesimpleworkarounddescribedat#59.
ImportantchangesMopidynowdependsonPykka>=0.
12.
IfyouinstallfromAPT,Pykkawillautomaticallybeinstalled.
IfyouarenotinstallingfromAPT,youmayinstallPykkafromPyPI:98Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacfsudopipinstall-UPykkaIfyouusetheSpotifybackend,youshouldupgradetolibspotify0.
0.
7andthelatestpyspotifyfromtheMopidydevelopers.
IfyouinstallfromAPT,libspotifyandpyspotifywillautomaticallybeupgraded.
IfyouarenotinstallingfromAPT,followtheinstructionsatInstallation.
ChangesMopidynowusePykkaactorsforthreadmanagementandinter-threadcommunication.
Theimmediatead-vantageofthisisthatMopidynowworksonPython2.
7,whichisthedefaultone.
g.
Ubuntu11.
04.
(Fixes:#66)Spotifybackend:–FixedmultiplesegmentationfaultsduetobugsinPyspotify.
ThankstoAntoinePierlot-GarcinandJamieKirkpatrickforpatchestoPyspotify.
–Bettererrormessagesonwrongloginornetworkproblems.
ThankstoAntoinePierlot-GarcinforpatchestoMopidyandPyspotify.
(Fixes:#77)–Reduceloglevelfortriviallogmessagesfromwarningtoinfo.
(Fixes:#71)–Pauseplaybackonnetworkconnectionerrors.
(Fixes:#65)Localbackend:–Fixcrashinmopidy-scanifatrackhasnoartistname.
ThankstoMartinsGrunskisfortestandpatchand"octe"forpatch.
–Fixcrashintag_cacheparsingifatrackhasnototalnumberoftracksinthealbum.
ThankstoMartinsGrunskisforthepatch.
MPDfrontend:–Addsupportfor"date"queriestoboththefindandsearchcommands.
Thismakesmedialibrarybrowsinginncmpcppwork,thoughveryslowduetoallthemetadatarequeststoSpotify.
–Addsupportforplay"-1"wheninplayingorpausedstate,whichxesresumeandadditionoftrackstothecurrentplaylistwhileplayingfortheMPoDclient.
–Fixbugwherestatusreturnedsong:None,whichcausedMPDroidtocrash.
(Fixes:#69)–GracefullyfallbacktoIPv4socketsonsystemsthatsupportsIPv6,buthasturneditoff.
(Fixes:#75)GStreameroutput:–UseuridecodebinforplayingaudiofrombothSpotifyandthelocalbackend.
Thiscontributestosupportformultiplebackendssimultaneously.
Settings:–Fixcrashonmopidy--list-settingsoncleaninstallation.
ThankstoMartinsGrunskisforthebugreportandpatch.
(Fixes:#63)Packaging:–Replacetestdatasymlinkswithreallestoavoidsymlinkissueswheninstallingwithpip.
(Fixes:#68)Debugging:–Includeplatform,architecture,Linuxdistribution,andPythonversioninthedebuglog,toeasedebuggingofissueswithattacheddebuglogs.
15.
3.
Changelog0.
xseries99MopidyDocumentation,Release3.
1.
1-1-gf17acacf15.
3.
35v0.
3.
1(2011-01-22)Acoupleofxestothe0.
3.
0releaseisneededtogetasmoothinstallation.
BugxesTheSpotifyapplicationkeywasmissingfromthePythonpackage.
InstallationofthePythonpackageasanormaluserfailedbecauseitdidnothavepermissionstoinstallmopidy.
desktop.
Theleisnowonlyinstallediftheinstallationisexecutedastherootuser.
15.
3.
36v0.
3.
0(2011-01-22)Mopidy0.
3.
0bringsabunchofsmallchangesallovertheplace,butnolargechanges.
ThemainfeaturesaresupportforhighbitrateaudiofromSpotify,andMPDpasswordauthentication.
Regardingthedocs,we'veimprovedtheinstallationinstructionsanddoneabitoftestingoftheavailableAndroidandiOSclientsforMPD.
Pleasenotethat0.
3.
0requiressomeupdateddependencies,aslistedunderImportantchangesbelow.
Also,thereisaknownbugintheSpotifyplaylistloading,asdescribedbelow.
Asthebugwilltakesometimetoxandhasaknownworkaround,wedidnotwanttodelaythereleasewhilewaitingforaxtothisproblem.
Warning:KnownbuginSpotifyplaylistloadingThereisaknownbugintheloadingofSpotifyplaylists.
ThisbugaffectsbothMopidy0.
2.
1and0.
3.
0,giventhatyouuselibspotify0.
0.
6.
Toavoidthebug,eitheruseMopidy0.
2.
1withlibspotify0.
0.
4,oruseeitherMopidyversionwithlibspotify0.
0.
6andfollowthesimpleworkarounddescribedat#59.
ImportantchangesIfyouusetheSpotifybackend,youneedtoupgradetolibspotify0.
0.
6andthelatestpyspotifyfromtheMopidydevelopers.
FollowtheinstructionsatInstallation.
IfyouusetheLast.
fmfrontend,youneedtoupgradetopylast0.
5.
7.
Runsudopipinstall--upgradepylastorinstallMopidyfromAPT.
ChangesSpotifybackend:–Supporthighbitrate(320k)audio.
Setthenewsettingmopidy.
settings.
SPOTIFY_HIGH_BITRATEtoTruetoswitchtohighbitrateaudio.
–Renamemopidy.
backends.
libspotifytomopidy.
backends.
spotify.
Ifyouhavesetmopidy.
settings.
BACKENDSexplicitly,youmayneedtoupdatethesetting'svalue.
–Catchandlogerrorcausedbyplaylistfolderboundariesbeingthreatedasnormalplaylists.
Moreperma-nentxrequiressupportforcheckingplaylisttypesinpyspotify(see#62).
–FixcrashonfailedlookupoftrackbyURI.
(Fixes:#60)Localbackend:–Addmopidy-scancommandtogeneratetag_cacheleswithoutanyhelpfromtheoriginalMPDserver.
See"Generatingalocallibrary"forinstructionsonhowtouseit.
–FixsupportforUTF-8encodingintagcaches.
MPDfrontend:100Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacf–Addsupportforpasswordauthentication.
Seemopidy.
settings.
MPD_SERVER_PASSWORDfordetailsonhowtouseit.
(Fixes:#41)–Supportsetvol50withoutquotesaroundtheargument.
FixesvolumecontrolinDroidMPD.
–Supportseek1120withoutquotesaroundthearguments.
FixesseekinDroidMPD.
Last.
fmfrontend:–UpdatetouseLast.
fm'snewScrobbling2.
0API,astheoldSubmissionsProtocol1.
2.
1isdeprecated.
(Fixes:#33)–Fixcrashwhentrackobjectdoesnotcontainalltheexpectedmetadata.
–FixcrashwhenresponsefromLast.
fmcannotbedecodedasUTF-8.
(Fixes:#37)–FixcrashwhenresponsefromLast.
fmcontainsinvalidXML.
–FixcrashwhenresponsefromLast.
fmhasaninvalidHTTPstatusline.
Mixers:–Supportuseofunicodestringsforsettingsspecictomopidy.
mixers.
nad.
Settings:–Automaticallyexpandthe"~"charactedtotheuser'shomedirectoryandmakethepathabsoluteforsettingswithnamesendingin_PATHor_FILE.
–Renamethefollowingsettings.
Thesettingsvalidatorwillwarnyouifyouneedtochangeyourlocalsettings.
*LOCAL_MUSIC_FOLDERtomopidy.
settings.
LOCAL_MUSIC_PATH*LOCAL_PLAYLIST_FOLDERtomopidy.
settings.
LOCAL_PLAYLIST_PATH*LOCAL_TAG_CACHEtomopidy.
settings.
LOCAL_TAG_CACHE_FILE*SPOTIFY_LIB_CACHEtomopidy.
settings.
SPOTIFY_CACHE_PATH–FixbugwhichmadesettingssettoNoneor0causeamopidy.
SettingsErrortoberaised.
Packaginganddistribution:–SetupAPTrepositoryandcreateDebianpackagesofMopidy.
SeeInstallationforinstructionsforhowtoinstallMopidy,includingalldependencies,fromAPT.
–Installmopidy.
desktoplethatmakesMopidyavailablefrome.
g.
Gnomeapplicationmenus.
API:–RenameandgeneralizePlaylist.
_with(**kwargs)tomopidy.
models.
ImmutableObject.
copy().
–Addmusicbrainz_ideldtomopidy.
models.
Artist,mopidy.
models.
Album,andmopidy.
models.
Track.
–Prepareformulti-backendsupport(see#40)byintroducingtheproviderconcept.
SplitthebackendAPIintoabackendcontrollerAPI(forfrontenduse)andabackendproviderAPI(forbackendimplementationuse),whichincludesthefollowingchanges:*RenameBaseBackendtomopidy.
backends.
base.
Backend.
*RenameBaseCurrentPlaylistControllertomopidy.
backends.
base.
CurrentPlaylistController.
*SplitBaseLibraryControllertomopidy.
backends.
base.
LibraryControllerandmopidy.
backends.
base.
BaseLibraryProvider.
15.
3.
Changelog0.
xseries101MopidyDocumentation,Release3.
1.
1-1-gf17acacf*SplitBasePlaybackControllertomopidy.
backends.
base.
PlaybackControllerandmopidy.
backends.
base.
BasePlaybackProvider.
*SplitBaseStoredPlaylistsControllertomopidy.
backends.
base.
StoredPlaylistsControllerandmopidy.
backends.
base.
BaseStoredPlaylistsProvider.
–MoveBaseMixertomopidy.
mixers.
base.
BaseMixer.
–Adddocsforthecurrentnon-stableoutputAPI,mopidy.
outputs.
base.
BaseOutput.
15.
3.
37v0.
2.
1(2011-01-07)Thisisamaintenancereleasewithoutanynewfeatures.
BugxesFixcrashinmopidy.
frontends.
lastfmwhichoccurredatplaybackifeitherpylastwasnotinstalledortheLast.
fmscrobblingwasnotcorrectlycongured.
Thescrobblingthreadnowshutsproperlydownatfailure.
15.
3.
38v0.
2.
0(2010-10-24)InMopidy0.
2.
0we'veaddedaLast.
fmscrobblingsupport,whichmeansthatMopidynowcansubmitmetadataaboutthetracksyouplaytoyourLast.
fmprole.
Seemopidy.
frontends.
lastfmfordetailsonnewdependenciesandsettings.
IfyouuseMopidy'sLast.
fmsupport,pleasejointheMopidygroupatLast.
fm.
WiththeexceptionoftheworkontheLast.
fmscrobbler,therehasbeenacoupleofquietmonthsintheMopidycamp.
Abouttheonlythinggoingon,hasbeenstabilizationworkandbugxing.
AllbugsreportedonGitHub,plussome,havebeenxedin0.
2.
0.
Thus,wehopethiswillbeagreatrelease!
We'veworkedabitonOSXsupport,butnotallissuesarecompletelysolvedyet.
#25istheonethatiscurrentlyblockingOSXsupport.
Anyhelpsolvingitwillbegreatlyappreciated!
Finally,pleaseupdateyourpyspotifyinstallationwhenupgradingtoMopidy0.
2.
0.
Thelatestpyspotifygotaxforthesegmentationfaultthatoccurredwhenplayingmusicandsearchingatthesametime,thankstoValentinDavid.
ImportantchangesAddedaLast.
fmscrobbler.
Seemopidy.
frontends.
lastfmfordetails.
ChangesLoggingandcommandlineoptions:–Simplifythedefaultlogformat,mopidy.
settings.
CONSOLE_LOG_FORMAT.
Fromauser'spointofview:Lessnoise,moreinformation.
–Renamethemopidy--dumpcommandlineoptiontomopidy--save-debug-log.
–Renamesettingmopidy.
settings.
DUMP_LOG_FORMATtomopidy.
settings.
DEBUG_LOG_FORMATanduseitformopidy--verbosetoo.
–Renamesettingmopidy.
settings.
DUMP_LOG_FILENAMEtomopidy.
settings.
DEBUG_LOG_FILENAME.
MPDfrontend:–MPDcommandlistnowsupportsqueriesbyartist,albumname,anddate,asusedbye.
g.
theArioclient.
(Fixes:#20)–MPDcommandadd""andaddid""nowbehavesasexpected.
(Fixes#16)102Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacf–MPDcommandplayid"-1"nowcorrectlyresumesplaybackifpaused.
Randommode:–Fixwrongbehavioronendoftrackandnextafterrandommodehasbeenused.
(Fixes:#18)–Fixinniterecursionloopcrashonplaybackofnon-playabletrackswheninrandommode.
(Fixes#17)–Fixassertionerrorthathappenedifoneremovedtracksfromthecurrentplaylist,whileinrandommode.
(Fixes#22)Switchedfromusingsubprocessestothreads.
(Fixes:#14)mopidy.
outputs.
gstreamer:Setcapsontheappsrcbinbeforeuse.
ThismakessoundoutputworkwithGStreamer>=0.
10.
29,whichincludestheversionsusedinUbuntu10.
10andonOSXifusingHomebrew.
(Fixes:#21,#24,contributesto#14)Improvedhandlingofuncaughtexceptionsinthreads.
Theentireprocessshouldnowexitimmediately.
15.
3.
39v0.
1.
0(2010-08-23)Afterthreeweeksoflongnightsandsprintswe'renallypleasedenoughwiththestateofMopidytoremovethealphalabel,anddoaregularrelease.
Mopidy0.
1.
0gotimportantimprovementsinsearchfunctionality,workingtrackpositionseeking,noknownstabilityissues,andgreatlyimprovedMPDclientsupport.
Therearelotsofchangessince0.
1.
0a3,andweurgeyoutoatleastreadtheimportantchangesbelow.
ThisreleasedoesnotsupportOSX.
We'resorryaboutthat,andareworkingonxingtheOSXissuesforafuturerelease.
Youcantracktheprogressat#14.
ImportantchangesLicensechangedfromGPLv2toApacheLicense,version2.
0.
GStreamerisnowarequireddependency.
SeeourGStreamerinstallationdocs.
mopidy.
backends.
libspotifyisnowthedefaultbackend.
mopidy.
backends.
despotifyisnolongeravailable.
Thismeansthatyouneedtoinstallthedependenciesforlibspotify.
Ifyouusedmopidy.
backends.
libspotifypreviously,pyspotifymustbeupdatedwhenupdatingtothisrelease,togetworkingseekfunctionality.
mopidy.
settings.
SERVER_HOSTNAMEandmopidy.
settings.
SERVER_PORThasbeenrenamedtomopidy.
settings.
MPD_SERVER_HOSTNAMEandmopidy.
settings.
MPD_SERVER_PORTtoallowformultiplefrontendsinthefuture.
ChangesExitearlyifnotPython>=2.
6,translator}tomatchnaminginback-ends.
–Removesettingmopidy.
settings.
SERVERandmopidy.
settings.
FRONTENDinfavourofthenewmopidy.
settings.
FRONTENDS.
–RunMPDserverinitsownprocess.
Backends:–Renamemopidy.
backends.
gstreamertomopidy.
backends.
local.
–Removemopidy.
backends.
despotify,asDespotifyislittlemaintainedandtheLibspotifyback-endisworkingmuchbetter.
(Fixes:#9,#10,#13)–ASpotifyapplicationkeyisnowbundledwiththesource.
mopidy.
settings.
SPOTIFY_LIB_APPKEYisthusremoved.
–Iffailingtoplayatrack,playbackwillskiptothenexttrack.
–Bothmopidy.
backends.
libspotifyandmopidy.
backends.
localhavebeenrewrittentousethenewcommonGStreameraudiooutputmodule,mopidy.
outputs.
gstreamer.
Mixers:–Addednewmopidy.
mixers.
gstreamer_software.
GStreamerSoftwareMixerwhichnowisthedefaultmixeronallplatforms.
–Newsettingmopidy.
settings.
MIXER_MAX_VOLUMEforcappingthemaximumoutputvolume.
BackendAPI:–Relocatefrommopidy.
backendstomopidy.
backends.
base.
–Theideldofmopidy.
models.
Trackhasbeenremoved,asitisnolongerneededaftertheCPIDrefactoring.
–mopidy.
backends.
base.
BaseBackend()nowacceptsanoutput_queuewhichitcanusetosendmessages(i.
e.
audiodata)totheoutputprocess.
–mopidy.
backends.
base.
BaseLibraryController.
find_exact()nowacceptskeywordargumentsoftheformfind_exact(artist=['foo'],album=['bar']).
104Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacf–mopidy.
backends.
base.
BaseLibraryController.
search()nowacceptskeywordargumentsoftheformsearch(artist=['foo','fighters'],album=['bar','grooves']).
–mopidy.
backends.
base.
BaseCurrentPlaylistController.
append()replacesmopidy.
backends.
base.
BaseCurrentPlaylistController.
load().
Usemopidy.
backends.
base.
BaseCurrentPlaylistController.
clear()ifyouwanttoclearthecurrentplaylist.
–Thefollowingeldsinmopidy.
backends.
base.
BasePlaybackControllerhasbeenrenamedtoreecttheirrelationtomethodscalledonthecontroller:*next_tracktotrack_at_next*next_cp_tracktocp_track_at_next*previous_tracktotrack_at_previous*previous_cp_tracktocp_track_at_previous–mopidy.
backends.
base.
BasePlaybackController.
track_at_eotandmopidy.
backends.
base.
BasePlaybackController.
cp_track_at_eothasbeenaddedtobetterhandlethedifferencebetweentheuserpressingnextandthecurrenttrackending.
–Renamemopidy.
backends.
base.
BasePlaybackController.
new_playlist_loaded_callback()tomopidy.
backends.
base.
BasePlaybackController.
on_current_playlist_change().
–Renamemopidy.
backends.
base.
BasePlaybackController.
end_of_track_callback()tomopidy.
backends.
base.
BasePlaybackController.
on_end_of_track().
–Removemopidy.
backends.
base.
BaseStoredPlaylistsController.
search()sinceitwasbarelyused,untested,andwegotnousecasefornon-exactsearchinstoredplaylistsyet.
Usemopidy.
backends.
base.
BaseStoredPlaylistsController.
get()instead.
15.
3.
40v0.
1.
0a3(2010-08-03)Inthelasttwomonths,Mopidy'sMPDfrontendhasgottenlotsofstabilityxesanderrorhandlingimprovements,propersupportforhavingthesametrackmultipletimesinaplaylist,andsupportforIPv6.
Wehavealsoxedthechoppyplaybackonthelibspotifybackend.
Fortheroadaheadofus,wegotanupdatedreleaseroadmapwithourgoalsforthe0.
1to0.
3releases.
EnjoythebestalpharelaseofMopidyever:-)ChangesMPDfrontend:–SupportIPv6.
–addidrespondsproperlyonerrorsinsteadofcrashing.
–commandssupport,whichmakesRelaXXPlayerworkwithMopidy.
(Fixes:#6)–Doesnolongercrashoninvaliddata,i.
e.
non-UTF-8data.
–ACKerrormessagesarenowMPD-compliant,whichshouldmakeclientshandleerrorsfromMopidybetter.
–Requeststoexistingcommandswithwrongargumentsarenolongerreportedasunknowncommands.
15.
3.
Changelog0.
xseries105MopidyDocumentation,Release3.
1.
1-1-gf17acacf–command_list_endbeforecommand_list_startnowreturnsunknowncommanderrorinsteadofcrashing.
–listacceptseldargumentwithoutquotesandcapitalized,toworkwithGMPCandncmpc.
–noidlecommandnowreturnsOKinsteadofanerror.
Shouldmakesomeclientsworkabitbetter.
–Havingmultipleidenticaltracksinaplaylistisnowworkingproperly.
(CPIDrefactoring)Despotifybackend:–Catchandlogspytify.
SpytifyError.
(Fixes:#11)Libspotifybackend:–FixchoppyplaybackusingtheLibspotifybackendbyusingblockingALSAmode.
(Fixes:#7)BackendAPI:–Anewdatastructurecalledcp_trackisnowusedinthecurrentplaylistcontrollerandtheplaybackcontroller.
Acp_trackisatwo-tupleof(CPIDinteger,mopidy.
models.
Track),identifyinganinstanceofatrackuniquelywithinthecurrentplaylist.
–mopidy.
backends.
BaseCurrentPlaylistController.
load()nowacceptslistsofmopidy.
models.
Trackinsteadofmopidy.
models.
Playlist,asnoneoftheothereldsonthePlaylistmodelwasinuse.
–mopidy.
backends.
BaseCurrentPlaylistController.
add()nowreturnsthecp_trackaddedtothecurrentplaylist.
–mopidy.
backends.
BaseCurrentPlaylistController.
remove()nowtakescriterias,justlikemopidy.
backends.
BaseCurrentPlaylistController.
get().
–mopidy.
backends.
BaseCurrentPlaylistController.
get()nowreturnsacp_track.
–mopidy.
backends.
BaseCurrentPlaylistController.
tracksisnowread-only.
Usethemethodstochangeitscontents.
–mopidy.
backends.
BaseCurrentPlaylistController.
cp_tracksisaread-onlylistofcp_track.
Usethemethodstochangeitscontents.
–mopidy.
backends.
BasePlaybackController.
current_trackisnowjustforconve-nienceandread-only.
Tosetthecurrenttrack,assignacp_tracktomopidy.
backends.
BasePlaybackController.
current_cp_track.
–mopidy.
backends.
BasePlaybackController.
current_cpidistheread-onlyCPIDofthecurrenttrack.
–mopidy.
backends.
BasePlaybackController.
next_cp_trackisthenextcp_trackintheplaylist.
–mopidy.
backends.
BasePlaybackController.
previous_cp_trackisthepreviouscp_trackintheplaylist.
–mopidy.
backends.
BasePlaybackController.
play()nowtakesacp_track.
106Chapter15.
HistoryMopidyDocumentation,Release3.
1.
1-1-gf17acacf15.
3.
41v0.
1.
0a2(2010-06-02)IthasbeenaratherslowmonthforMopidy,butwewouldliketokeepupwiththeestablishedpaceofatleastareleasepermonth.
ChangesImprovementstoMPDprotocolhandling,makingMopidyworkmuchbetterwithagroupofclients,includingncmpc,MPoD,andTheremin.
Newcommandlineagmopidy--dumpfordumpingdebuglogtodump.
loginthecurrentdirectory.
Newsettingmopidy.
settings.
MIXER_ALSA_CONTROLforforcingwhatALSAcontrolmopidy.
mixers.
alsa.
AlsaMixershoulduse.
15.
3.
42v0.
1.
0a1(2010-05-04)SincethepreviousreleaseMopidyhasseenabout300commits,morethan200newtests,alibspotifyrelease,andmajorfeatureadditionstoSpotify.
ThenewreleasesfromSpotifyhaveleadtoupdatestoourdependencies,andalsotonewbugsinMopidy.
Thus,thisisprimarilyabugxrelease,eventhoughthenotyetnishedworkonaGStreamerbackendhavebeenmerged.
Allusersarerecommendedtoupgradeto0.
1.
0a1,andshouldatthesametimeensurethattheyhavethelatestversionsofourdependencies:Despotifyr508ifyouareusingDespotifyBackend,andpyspotify1.
1withlibspotify0.
0.
4ifyouareusingLibspotifyBackend.
Asalways,reportproblemsatourIRCchannelorourissuetracker.
Thanks!
ChangesBackendAPIchanges:–Removedbackend.
playback.
volumewrapper.
Usebackend.
mixer.
volumedirectly.
–Renamedbackend.
playback.
playlist_positiontocurrent_playlist_positiontomatchnamingofcurrent_track.
–Replacedget_by_id()withamoreexibleget(**criteria).
MergedthegstreamerbranchfromThomasAdamcik:–Morethan200newtests,andthusseveralbugxestoexistingcode.
–Severalnewgenericfeatures,likeshufe,consume,andplaylistrepeat.
(Fixes:#3)–[WorkinProgress]AnewbackendforplayingmusicfromalocalmusicarchiveusingtheGStreamerlibrary.
Mademopidy.
mixers.
alsa.
AlsaMixerworkonmachineswithoutamixernamed"Master".
Makemopidy.
backends.
DespotifyBackendignorelocallesinplaylists(featureaddedinSpotify0.
4.
3).
ReportedbyRichardHaugenOlsen.
Andmuchmore.
15.
3.
Changelog0.
xseries107MopidyDocumentation,Release3.
1.
1-1-gf17acacf15.
3.
43v0.
1.
0a0(2010-03-27)"Releaseearly.
Releaseoften.
Listentoyourcustomers.
"wroteEricS.
RaymondinTheCathedralandtheBazaar.
Threemonthsofdevelopmentshouldbemorethanenough.
Wehavemoretodo,butMopidyisworkingandusable.
0.
1.
0a0isanalpharelease,whichbasiclymeanswewillstillchangeAPIs,addfeatures,etc.
beforethenal0.
1.
0release.
Butthesoftwareisusableasis,sowereleaseit.
Pleasegiveitatryandgiveusfeedback,eitheratourIRCchannelorthroughtheissuetracker.
Thanks!
ChangesInitialversion.
Nochangelogavailable.
108Chapter15.
HistoryCHAPTERSIXTEENVERSIONINGMopidyfollowsSemanticVersioning.
Insummarythismeansthatourversionnumbershavethreeparts,MA-JOR.
MINOR.
PATCH,whichchangeaccordingtothefollowingrules:WhenwemakeincompatibleAPIchanges,weincreasetheMAJORnumber.
Whenweaddfeaturesinabackwards-compatiblemanner,weincreasetheMINORnumber.
Whenwexbugsinabackwards-compatiblemanner,weincreasethePATCHnumber.
ThepromiseisthatifyoumakeaMopidyextensionforMopidy1.
0,itshouldworkunchangedwithanyMopidy1.
xrelease,butprobablynotwith2.
0.
Whenanewmajorversionisreleased,youmustreviewtheincompatiblechangesandupdateyourextensionaccordingly.
16.
1ReleasescheduleWeintendtohaveaboutonefeaturereleaseeverymonthinperiodsofactivedevelopment.
Thefeaturesaddedisamixofwhatwefeelismostimportant/requestedofthemissingfeatures,andfeatureswedevelopjustbecausewendthemfuntomake,eventhoughtheymaybeusefulforveryfewusersorforalimitedusecase.
Bugxreleaseswillbereleasedwheneverwediscoverbugsthataretooserioustowaitforthenextfeaturerelease.
Wewillonlyreleasebugxreleasesforthelastfeaturerelease.
E.
g.
when1.
2.
0isreleased,wewillnolongerprovidebugxreleasesforthe1.
1.
xseries.
Inotherwords,therewillbejustasinglesupportedreleaseatanypointintime.
Thisistonotspreadourlimitedresourcestoothin.
109MopidyDocumentation,Release3.
1.
1-1-gf17acacf110Chapter16.
VersioningCHAPTERSEVENTEENAUTHORSMopidyiscopyright2009-2020SteinMagnusJodalandcontributors.
MopidyislicensedundertheApacheLicense,Version2.
0.
ThefollowingpersonshavecontributedtoMopidy.
Thelistisintheorderofrstcontribution.
Fordetailsonwhohavecontributedwhat,pleaserefertoourGitrepository.
SteinMagnusJodalJohannesKnutsenThomasAdamcikKristianKletteMartinsGrunskisHenrikOlssonAntoinePierlot-GarcinJohnBckstrandFredHatfullErlingBrresenDavidCarusoChristianJohansenMattBrayTrygveAabergeWoutervanWijkJeremyB.
MerrillAdamRiggErnstBammerNickSteelZanDobersekThomasResJanezTrohaTobiasSauerweinAlliWitheford111MopidyDocumentation,Release3.
1.
1-1-gf17acacfAlexandrePetitjeanTerjeLarsenJavierDomingoCansinoPavolBabincakJavierDomingoLasseBigumDavidEisnerPlRuudThomasKemmerPaulConnolleyLukeGiulianiColinMontgomerieSimondeBakkerArnaudBarisain-MonroseNathanHarperPierpaoloFrasaThomasScholtesSamWillcocksIgnasiFoschArjunNaikChristopherSchirnerDmitrySandalovLukasVogelThomasAmlandDeniBertovicAliUkaniDirkGroenenJohnCassLauraBarberJakabKristófRonaldZielaznickiWojciechWnetrzakCamiloNovaDraenLuˇcaninNaglisJonaitisKyleHeyne112Chapter17.
AuthorsMopidyDocumentation,Release3.
1.
1-1-gf17acacfTomRothMarkGreenwoodSteinKarlsenDejanProkicEricJahnMikhailGolubevDaniloBargenBjrnarSnoksrudGiorgosLogiotatidisBenEvansvrs01CadelWatsonLockBonniotGustafHallbergkozecJellevanderWaaAlexMaloneDanielHahlerBryanBennettJensLütjenLinaHeDanielTLarsKruseBenjaminChrétienSeppSTAIsmaelAsensioTomParkerNantasNardelliNaglisJonaitisAlexanderJaworowskiDonArmstrongNadavTauAleksandarBenicTomSwirlyPiotrDobrowolskiTomasSusanka113MopidyDocumentation,Release3.
1.
1-1-gf17acacfJamesBarnsleyCayshoBrendanJonesMarvinPreussBernhardGehlCL123123PiotrDobrowolskiNickAquinaMarcusGtlingDominiqueTardifAlexeyMurzKorepovJarrydTilbrookDanBroughJonathanJefferiesMatthieuMelquiondDamienCassouLeonidBogdanovGeoffroyYouriBerretDanStowellGildasLeNadanZvonimirFrasSimonVivienHenryHugovanKemenadeTobiasGirstmairJakubFijakowskiJonathanJefferiesPrajjwalNijharaAsmiJafarSaloniGuptaParthVermaFlamm,MatthewHMatthewGamblevery-amusedIfwanttohelpusmakingMopidybetter,thebestwaytodosoistocontributebacktothecommunity,eitherthroughcode,documentation,tests,bugreports,orbyhelpingotherusers,spreadingtheword,etc.
SeeContributingforaheadstart.
114Chapter17.
AuthorsCHAPTEREIGHTEENSPONSORSTheMopidyprojectwouldliketothankthefollowingsponsorsforsupportingtheproject.
18.
1FastlyFastlyletsMopidyusetheirCDNforfree.
18.
2DiscourseDiscoursesponsorsMopidywithfreehostingofourdiscussionforumathttps://discourse.
mopidy.
com.
115MopidyDocumentation,Release3.
1.
1-1-gf17acacf116Chapter18.
SponsorsCHAPTERNINETEENCONTRIBUTINGIfyouwanttocontributetoMopidy,herearesometipstogetyoustarted.
19.
1AskingquestionsPleasegetintouchwithusinoneofthesewayswhenrequestinghelpwithMopidyanditsextensions:OurDiscourseforum:discourse.
mopidy.
com.
The#mopidy-usersstreamonZulipchat:mopidy.
zulipchat.
com.
Beforeaskingforhelp,itmightbeworthyourtimetoreadtheTroubleshootingpage,bothsoyoumightndasolutiontoyourproblembutalsotobeabletoprovideusefuldetailswhenaskingforhelp.
19.
2HelpingusersIfyouwanttocontributetoMopidy,agreatplacetostartisbyhelpingotherusersinthediscussionforumandthe#mopidy-usersZulipstream.
Thisisacontributionwevaluehighly.
Asmorepeoplehelpwithusersupport,newusersgetfasterandbetterhelp.
Foryourownbenet,you'llquicklylearnwhatusersndconfusing,difcultorlacking,givingyousomeideasforwhereyoumaycontributeimprovements,eithertocodeordocumentation.
Lastly,thismayalsofreeuptimeforothercontributorstospendmoretimeonxingbugsorimplementingnewfeatures.
19.
3Issueguidelines1.
Ifyouneedhelp,seeAskingquestionsabove.
TheGitHubissuetrackerisnotasupportforum.
2.
Ifyouarenotsureifwhatyou'reexperiencingisabugornot,postinthediscussionforumrsttoverifythatit'sabug.
3.
Ifyouaresurethatyou'vefoundabugorhaveafeaturerequest,checkifthere'salreadyanissueintheissuetracker.
Ifthereis,seeifthereisanythingyoucanaddtohelpreproduceorxtheissue.
4.
Ifthereisnoexisingissuematchingyourbugorfeaturerequest,createanewissue.
Pleaseincludeasmuchrelevantinformationaspossible.
Ifit'sabug,includinghowtoreproducethebugandanyrelevantlogsorerrormessages.
117MopidyDocumentation,Release3.
1.
1-1-gf17acacf19.
4Pullrequestguidelines1.
Beforespendinganytimeonmakingapullrequest:Ifit'sabug,leanissue.
Ifit'sanenhancement,discussitwithotherMopidydevelopersrst,eitherinaGitHubissue,onthedis-cussionforum,oronZulipchat.
Makingsureyourideasandsolutionsarealignedwithothercontributorsgreatlyincreasestheoddsofyourpullrequestbeingquicklyaccepted.
2.
Createanewbranch,basedonthedevelopbranch,foreveryfeatureorbugx.
Keepbranchessmallandontopic,asthatmakesthemfareasiertoreview.
Weoftenusethefollowingnamingconventionforbranches:Featuresgettheprexfeature/,e.
g.
feature/track-last-modified-as-ms.
Bugxesgettheprexfix/,e.
g.
fix/902-consume-track-on-next.
Improvementstothedocumentationgettheprexdocs/,e.
g.
docs/add-ext-mopidy-spotify-tunigo.
3.
Followthecodestyle,especiallymakesuretheflake8linterdoesnotcomplainaboutanything.
CircleCIwillcheckthatyourpullrequestis"ake8clean".
SeeStylecheckingandlinting.
4.
Includetestsforanynewfeatureorsubstantialbugx.
SeeRunningtests.
5.
Includedocumentationforanynewfeature.
SeeWritingdocumentation.
6.
Feelfreetoincludeachangelogentryinyourpullrequest.
Thechangelogisindocs/changelog.
rst.
7.
Writegoodcommitmessages.
Followthetemplate"topic:description"fortherstlineofthecommitmessage,e.
g.
"mpd:Switchlistcommandtousinglist_distinct".
Seethecommithistoryforinspiration.
Usetherestofthecommitmessagetoexplainanythingyoufeelisn'tobvious.
It'sbettertohavethedetailsherethaninthepullrequestdescription,sincethecommitmessagewillliveforever.
Writeintheimperative,presenttense:"add"not"added".
Formoreinspiration,feelfreetoreadtheseblogposts:WritingGitcommitmessagesANoteAboutGitCommitMessagesOncommitmessages8.
Sendapullrequesttothedevelopbranch.
SeetheGitHubpullrequestdocsforhelp.
Note:IfyouarecontributingabugxforaspecicminorversionofMopidyyoushouldcreatethebranchbasedonrelease-x.
yinsteadofdevelop.
Whenthereleaseisdonethechangeswillbemergedbackintodevelopautomaticallyaspartofthenormalreleaseprocess.
SeeReleaseprocedures.
118Chapter19.
ContributingCHAPTERTWENTYDEVELOPMENTENVIRONMENTThispagedescribesacommondevelopmentsetupforworkingwithMopidyandMopidyextensions.
Ofcourse,theremaybeotherwaysthatworkbetterforyouandthetoolsyouuse,buthere'sonerecommendedwaytodoit.
Initialsetup–InstallMopidytheregularway–Makeadevelopmentworkspace–Makeavirtualenv–ClonetherepofromGitHub–InstallMopidyfromtheGitrepo–InstalldevelopmenttoolsRunningMopidyfromGitRunningtests–Testitall–Runningunittests–Continuousintegration–StylecheckingandlintingWritingdocumentationWorkingonextensions–Installingextensions–UpgradingextensionsContributionworkow–SettingupGitremotes–Creatingabranch–Creatingapullrequest–Updatingapullrequest119MopidyDocumentation,Release3.
1.
1-1-gf17acacf20.
1InitialsetupThefollowingstepshelpyougetagoodinitialsetup.
Theybuildoneachothertosomedegree,soifyou'renotveryfamiliarwithPythondevelopmentitmightbewisetoproceedintheorderlaidouthere.
InstallMopidytheregularwayMakeadevelopmentworkspaceMakeavirtualenvClonetherepofromGitHubInstallMopidyfromtheGitrepoInstalldevelopmenttools20.
1.
1InstallMopidytheregularwayInstallMopidytheregularway.
Mopidyhassomenon-Pythondependencieswhichmaybetrickytoinstall.
ThuswerecommendtoalwaysstartwithafullregularMopidyinstall,asdescribedinInstallation.
Thatis,ifyou'rerunninge.
g.
Debian,startwithinstallingMopidyfromDebianpackages.
20.
1.
2MakeadevelopmentworkspaceMakeadirectorytobeusedasaworkspaceforallyourMopidydevelopment:mkdir~/mopidy-devItwillcontainalltheGitrepositoriesyou'llcheckoutwhenworkingonMopidyandextensions.
20.
1.
3MakeavirtualenvMakeaPythonvirtualenvforMopidydevelopment.
ThevirtualenvwillwalloffMopidyanditsdependenciesfromtherestofyoursystem.
AlldevelopmentandinstallationofPythondependencies,versionsofMopidy,andextensionsaredoneinsidethevirtualenv.
ThiswayyourregularMopidyinstall,whichyousetupintherststep,isunaffectedbyyourhackingandwillalwaysbeworking.
Mostofususethevirtualenvwrappertoeaseworkingwithvirtualenvs,sothat'swhatwe'llbeusingfortheexampleshere.
First,installandsetupvirtualenvwrapperasdescribedintheirdocs.
TocreateavirtualenvnamedmopidywhichusesPython3.
7,allowsaccesstosystem-widepackageslikeGStreamer,andusestheMopidyworkspacedirectoryasthe"projectpath",run:mkvirtualenv-a~/mopidy-dev--python$(whichpython3.
7)\--system-site-packagesmopidyNow,eachtimeyouopenaterminalandwanttoactivatethemopidyvirtualenv,run:workonmopidyThiswillbothactivatethemopidyvirtualenv,andchangethecurrentworkingdirectoryto~/mopidy-dev.
120Chapter20.
DevelopmentenvironmentMopidyDocumentation,Release3.
1.
1-1-gf17acacf20.
1.
4ClonetherepofromGitHubOnceinsidethevirtualenv,it'stimetoclonethemopidy/mopidyGitrepofromGitHub:gitclonehttps://github.
com/mopidy/mopidy.
gitWhenyou'veclonedthemopidyGitrepo,cdintoit:cd~/mopidy-dev/mopidy/WithafreshcloneoftheGitrepo,youshouldstartoutonthedevelopbranch.
Thisiswhereallfeaturesforthenextfeaturereleaseland.
Toconrmthatyou'reontherightbranch,run:gitbranch20.
1.
5InstallMopidyfromtheGitrepoNextup,we'llwanttorunMopidyfromtheGitrepo.
There'stworeasonsforthis:rstofall,itletsyoueasilychangethesourcecode,restartMopidy,andseethechangetakeeffect.
Second,it'saconvenientwaytokeepatthebleedingedge,testingthelatestdevelopmentsinMopidyitselfortestsomeextensionagainstthelatestMopidychanges.
Assumingyou'restillinsidetheGitrepo,usepiptoinstallMopidyfromtheGitrepoinan"editable"form:pipinstall--upgrade--editable.
Thiswillnotcopythesourcecodeintothevirtualenv'ssite-packagesdirectory,butinsteadcreatealinktherepointingtotheGitrepo.
Usingcdsitepackagesfromvirtualenvwrapper,wecanquicklyshowthattheinstalledMopidy.
egg-linklepointsbacktotheGitrepo:$cdsitepackages$catMopidy.
egg-link/home/user/mopidy-dev/mopidy.
%$ItwillalsocreateamopidyexecutableinsidethevirtualenvthatwillalwaysrunthelatestcodefromtheGitrepo.
Usinganothervirtualenvwrappercommand,cdvirtualenv,wecanshowthattoo:$cdvirtualenv$catbin/mopidy.
.
.
Theexecutableshouldcontainsomethinglikethis,usingpkg_resourcestolookupMopidy's"consolescript"entrypoint:#!
/home/user/virtualenvs/mopidy/bin/python2#EASY-INSTALL-ENTRY-SCRIPT:'Mopidy==0.
19.
5','console_scripts','mopidy'__requires__='Mopidy==0.
19.
5'importsysfrompkg_resourcesimportload_entry_pointif__name_main__':sys.
exit(load_entry_point('Mopidy==0.
19.
5','console_scripts','mopidy')())20.
1.
Initialsetup121MopidyDocumentation,Release3.
1.
1-1-gf17acacfNote:Itstillworkstorunpythonmopidydirectlyonthe~/mopidy-dev/mopidy/mopidy/Pythonpack-agedirectory,butifyoudon'trunthepipinstallcommandabove,theextensionsbundledwithMopidywillnotberegisteredwithpkg_resources,makingMopidyquiteuseless.
Third,thepipinstallcommandwillregisterthebundledMopidyextensionssothatMopidymayndthemthroughpkg_resources.
TheresultofthiscanbeseenintheGitrepo,inanewdirectorycalledMopidy.
egg-info,whichisignoredbyGit.
TheMopidy.
egg-info/entry_points.
txtleisofspecialinterestasitshowsbothhowtheaboveexecutableandthebundledextensionsareconnectedtotheMopidysourcecode:[console_scripts]mopidy=mopidy.
__main__:main[mopidy.
ext]http=mopidy.
http:Extensionsoftwaremixer=mopidy.
softwaremixer:Extensionstream=mopidy.
stream:ExtensionWarning:It'snotuncommontocleanupintheGitreponowandthen,e.
g.
byrunninggitclean.
Ifyoudothis,thentheMopidy.
egg-infodirectorywillberemoved,andpkg_resourceswillnolongerknowhowtolocatethe"consolescript"entrypointorthebundledMopidyextensions.
Thexissimplytoruntheinstallcommandagain:pipinstall--editable.
Finally,wecangobacktotheworkspace,againusingavirtualenvwrappertool:cdproject20.
1.
6InstalldevelopmenttoolsBeforecontinuing,youwillprobablywanttoinstallthedevelopmenttoolsweuseaswell.
Thesecanbeinstalledintotheactivevirtualenvbyrunning:pipinstall--upgrade--editable".
[dev]"NotethatthisisthesamecommandasyouusedtoinstallMopidyfromtheGitrepo,withtheadditionofthe[dev]sufxafter.
.
Thismakespipinstallthe"dev"setofextradependencies.
Exactlywhatthe"dev"setincludesaredenedinsetup.
py.
Toupgradethedevelopmenttoolsinthefuture,justreruntheexactsamecommand.
122Chapter20.
DevelopmentenvironmentMopidyDocumentation,Release3.
1.
1-1-gf17acacf20.
2RunningMopidyfromGitAslongasthevirtualenvisactivated,youcanstartMopidyfromanydirectory.
Simplyrun:mopidyTostopitagain,pressCtrl+C.
EverytimeyouchangecodeinMopidyoranextensionandwanttoseeitlive,youmustrestartMopidy.
Ifyouwanttoiteratequicklywhiledeveloping,itmaysoundabittedioustorestartMopidyforeveryminorchange.
Thenit'susefultohaveteststoexerciseyourcode.
.
.
20.
3RunningtestsMopidyhasquitegoodtestcoverage,andwewouldlikeallnewcodegoingintoMopidytocomewithtests.
TestitallRunningunittestsContinuousintegrationStylecheckingandlinting20.
3.
1TestitallYouneedtoknowatleastonecommand;theonethatrunsallthetests:toxThiswillrunexactlythesametestsasCircleCIrunsforallourbranchesandpullrequests.
Ifthiscommandturnsgreen,youcanbequitecondentthatyourpullrequestwillgetthegreenagfromCircleCIaswell,whichisarequirementforittobemerged.
Asthisistheultimatetestcommand,it'salsotheonetakingthemosttimetorun;uptoaminute,dependingonyoursystem.
But,ifyouhavepatience,thisisallyouneedtoknow.
AlwaysrunthiscommandbeforepushingyourchangestoGitHub.
Ifyoutakealookatthetoxcongle,tox.
ini,you'llseethattoxrunstestsinmultipleenvironments,includingaflake8environmentthatlintsthesourcecodeforissuesandadocsenvironmentthatteststhatthedocumentationcanbebuilt.
Youcanalsolimittoxtojusttestspecicenvironmentsusingthe-eoption,e.
g.
torunjustunittests:tox-epy37Tolearnmore,seethetoxdocumentation.
20.
2.
RunningMopidyfromGit123MopidyDocumentation,Release3.
1.
1-1-gf17acacf20.
3.
2RunningunittestsUnderthehood,tox-epy37willusepytestasthetestrunner.
Wecanalsouseitdirectlytorunalltests:pytestpytesthaslotsofpossibilities,soyou'llhavetodiveintotheirdocsandpluginstogetfullbenetfromit.
Togetyouinterested,herearesomeexamples.
Wecanlimittojusttestsinasingledirectorytosavetime:pytesttests/http/Withthehelpofthepytest-xdistplugin,wecanruntestswithfourPythonprocessesinparallel,whichusuallycutsthetesttimeinhalformore:pytest-n4Anotherusefulfeaturefrompytest-xdist,isthepossibilitytostoponthersttestfailure,watchthelesystemforchanges,andthenrerunthetests.
Thismakesforaveryquickcode-testcycle:pytest-f#or--looponfailWiththehelpofthepytest-covplugin,wecangetareportonwhatpartsofthegivenmodule,mopidyinthisexample,arecoveredbythetestsuite:pytest--cov=mopidy--cov-report=term-missingNote:UptodatetestcoveragestatisticscanalsobeviewedonlineatCodecov.
Ifwewanttospeedupthetestsuite,wecanevengetalistofthetenslowesttests:pytest--durations=10Bynow,youshouldbeconvincedthatrunningpytestdirectlyduringdevelopmentcanbeveryuseful.
20.
3.
3ContinuousintegrationMopidyusesthefreeserviceCircleCIforautomaticallyrunningthetestsuitewhencodeispushedtoGitHub.
ThisworksbothforthemainMopidyrepo,butalsoforanyforks.
Thisway,anycontributionstoMopidythroughGitHubwillautomaticallybetestedbyCircleCI,andthebuildstatuswillbevisibleintheGitHubpullrequestinterface,makingiteasiertoevaluatethequalityofpullrequests.
Foreachsuccessfulbuild,CircleCIsubmitscodecoveragedatatoCodecov.
Ifyou'reoutofwork,Codecovmighthelpyoundareasinthecodewhichcouldneedbettertestcoverage.
124Chapter20.
DevelopmentenvironmentMopidyDocumentation,Release3.
1.
1-1-gf17acacf20.
3.
4StylecheckingandlintingWe'requitepedanticaboutCodestyleandtryhardtokeeptheMopidycodebaseaverycleanandniceplacetoworkin.
Luckily,youcangetveryfarbyusingtheake8lintertocheckyourcodeforissuesbeforesubmittingapullrequest.
Mopidypassesallofake8'schecks,withonlyaveryfewexceptionsconguredinsetup.
cfg.
Youcaneitherruntheflake8toxenvironment,likeCircleCIwilldoonyourpullrequest:tox-eflake8Oryoucanrunake8directly:flake8Ifsuccessful,thecommandwillnotprintanythingatall.
Note:Insomerarecasesitdoesn'tmakesensetolistentoake8'swarnings.
Inthosecases,ignorethecheckbyappending#noqa:tothesourcelinethattriggersthewarning.
The#noqapartwillmakeake8skipallchecksontheline,whilethewarningcodewillhelpotherdeveloperslookupwhatyouareignoring.
20.
4WritingdocumentationTowritedocumentation,weuseSphinx.
SeetheirsiteforlotsofdocumentationonhowtouseSphinx.
Note:Togenerateafewgraphswhicharepartofthedocumentation,youneedsomeadditionaldependencies.
YoucaninstallthemfromAPTwith:sudoapt-getinstallpython-pygraphvizgraphvizTobuildthedocumentation,gointothedocs/directory:cd~/mopidy-dev/mopidy/docs/Then,toseeallavailablebuildtargets,run:makeTogenerateanHTMLversionofthedocumentation,run:makehtmlThegeneratedHTMLwillbeavailableat_build/html/index.
html.
Toopenitinabrowseryoucanruneitherofthefollowingcommands,dependingonyourOS:xdg-open_build/html/index.
html#Linuxopen_build/html/index.
html#OSXThedocumentationathttps://docs.
mopidy.
com/ishostedbyReadtheDocs,whichautomaticallyupdatesthedocu-mentationwhenachangeispushedtothemopidy/mopidyrepoatGitHub.
20.
4.
Writingdocumentation125MopidyDocumentation,Release3.
1.
1-1-gf17acacf20.
5WorkingonextensionsMuchoftheabovealsoappliestoMopidyextensions,thoughthey'reoftenabitsimpler.
Theydon'thavedocumenta-tionsitesandtheirtestsuitesareeithersmallandfast,orsadlymissingentirely.
Mostofthemusetoxandake8,andpytestcanbeusedtoruntheirtestsuites.
InstallingextensionsUpgradingextensions20.
5.
1InstallingextensionsAsalways,themopidyvirtualenvshouldbeactivewhenworkingonextensions:workonmopidyJustlikewithnon-developmentMopidyinstallations,youcaninstallextensionsusingpip:pipinstallMopidy-ScrobblerInstallinganextensionfromitsGitrepoworksthesamewayaswithMopidyitself.
First,gototheMopidyworkspace:cdproject#orcd~/mopidy-dev/ClonethedesiredMopidyextension:gitclonehttps://github.
com/mopidy/mopidy-spotify.
gitChangetothenewlycreatedextensiondirectory:cdmopidy-spotify/Then,installtheextensionin"editable"mode,sothatitcanbeimportedfromanywhereinsidethevirtualenvandtheextensionisregisteredanddiscoverablethroughpkg_resources:pipinstall--editable.
EveryextensionwillhaveaREADME.
rstle.
Itmaycontaininformationaboutextradependenciesrequired,devel-opmentprocess,etc.
Extensionsusuallyhaveachangeloginthereadmele.
20.
5.
2UpgradingextensionsExtensionsoftenhaveamuchquickerlifecyclethanMopidyitself,oftenwithdailyreleasesinperiodsofactivedevelopment.
Tondoutdatedextensionsinyourvirtualenv,youcanrun:pipsearchmopidyThiswilllistallavailableMopidyextensionsandcomparetheinstalledversionswiththelatestavailableones.
Toupgradeanextensioninstalledwithpip,simplyusepip:pipinstall--upgradeMopidy-Scrobbler126Chapter20.
DevelopmentenvironmentMopidyDocumentation,Release3.
1.
1-1-gf17acacfToupgradeanextensioninstalledfromaGitrepo,it'susuallyenoughtopullthenewchangesin:cd~/mopidy-dev/mopidy-spotify/gitpullOfcourse,ifyouhavelocalmodications,you'llneedtostashtheseawayonabranchorsimilarrst.
Dependingonthechangestotheextension,itmaybenecessarytoupdatethemetadataabouttheextensionpackagebyinstallingitin"editable"modeagain:pipinstall--editable.
20.
6ContributionworkowBeforeyoubeing,makesureyou'vereadtheContributingpageandtheguidelinesthere.
Thissectionwillfocusmoreonthepracticalworkow.
Fortheexamples,we'remakingachangetoMopidy.
ApproximatelythesameworkowshouldworkformostMopidyextensionstoo.
SettingupGitremotesCreatingabranchCreatingapullrequestUpdatingapullrequest20.
6.
1SettingupGitremotesAssumingwealreadyhavealocalGitcloneoftheupstreamGitrepoin~/mopidy-dev/mopidy/,wecanrungitremote-vtolisttheconguredremotesoftherepo:$gitremote-voriginhttps://github.
com/mopidy/mopidy.
git(fetch)originhttps://github.
com/mopidy/mopidy.
git(push)Forclarity,wecanrenametheoriginremotetoupstream:$gitremoterenameoriginupstream$gitremote-vupstreamhttps://github.
com/mopidy/mopidy.
git(fetch)upstreamhttps://github.
com/mopidy/mopidy.
git(push)Ifyouhaven'talready,forktherepositorytoyourownGitHubaccount.
Then,addthenewforkasaremotetoyourlocalclone:gitremoteaddmyusergit@github.
com:myuser/mopidy.
gitTheendresultisthatyouhaveboththeupstreamrepoandyourownforkasremotes:20.
6.
Contributionworkow127MopidyDocumentation,Release3.
1.
1-1-gf17acacf$gitremote-vmyusergit@github.
com:myuser/mopidy.
git(fetch)myusergit@github.
com:myuser/mopidy.
git(push)upstreamhttps://github.
com/mopidy/mopidy.
git(fetch)upstreamhttps://github.
com/mopidy/mopidy.
git(push)20.
6.
2CreatingabranchFetchthelatestdatafromallremoteswithoutaffectingyourworkingdirectory:gitremoteupdateNow,wearereadytocreateandcheckoutanewbranchoffoftheupstreamdevelopbranchforourwork:gitcheckout-bfix/666-crash-on-fooupstream/developDothework,whilerememberingtoadheretocodestyle,testthechanges,makenecessaryupdatestothedocumenta-tion,andmakingsmallcommitswithgoodcommitmessages.
AllasdescribedinContributingandelsewhereintheDevelopmentenvironmentguide.
20.
6.
3CreatingapullrequestWheneverythingisdoneandcommitted,pushthebranchtoyourforkonGitHub:gitpushmyuserfix/666-crash-on-fooGototherepositoryonGitHubwhereyouwantthechangemerged,inthiscasehttps://github.
com/mopidy/mopidy,andcreateapullrequest.
20.
6.
4UpdatingapullrequestWhenthepullrequestiscreated,CircleCIwillrunalltestsonit.
Ifsomethingfails,you'llgetnotiedbyemail.
Youmightaswelljustxtheissuesrightaway,aswewon'tmergeapullrequestwithoutagreenCircleCIbuild.
SeeRunningtestsonhowtorunthesametestslocallyasCircleCIrunsonyourpullrequest.
Whenyou'vexedtheissues,youcanupdatethepullrequestsimplybypushingmorecommitstothesamebranchinyourfork:gitpushmyuserfix/666-crash-on-fooLikewise,whenyougetreviewcommentsfromotherdevelopersonyourpullrequest,you'reexpectedtocreateadditionalcommitswhichaddressesthecomments.
Pushthemtoyourbranchsothatthepullrequestisupdated.
Note:Setuptheremoteasthedefaultpushtargetforyourbranch:gitbranch--set-upstream-tomyuser/fix/666-crash-on-fooThenyoucanpushmorecommitswithoutspecifyingtheremote:gitpush128Chapter20.
DevelopmentenvironmentCHAPTERTWENTYONEEXTENSIONDEVELOPMENTMopidystartedassimplyanMPDserverthatcouldplaymusicfromSpotify.
Earlyon,Mopidygotmultiple"fron-tends"toexposeMopidytomorethanjustMPDclients:forexamplethescrobblerfrontendthatscrobblesyourlisteninghistorytoyourLast.
fmaccount,theMPRISfrontendthatintegratesMopidyintotheUbuntuSoundMenu,andtheHTTPserverandJavaScriptplayerAPImakingwebbasedMopidyclientspossible.
InMopidy0.
9weaddedsupportformultiplemusicsourceswithoutstoppingandreconguringMopidy:forexamplethelocalbackendforplayingmusicfromyourdisk,thestreambackendforplayingInternetradiostreams,andtheSpotifyandSoundCloudbackends,forplayingmusicdirectlyfromthoseservices.
AlloftheseareexamplesofwhatyoucanaccomplishbycreatingaMopidyextension.
IfyouwanttocreateyourownMopidyextensionforsomethingthatdoesnotexistyet,thisguidetoextensiondevelopmentwillhelpyougetyourextensionrunninginnotime,andmakeitfeelthewayuserswouldexpectyourextensiontobehave.
21.
1AnatomyofanextensionExtensionsarelocatedinaPythonpackagecalledmopidy_somethingwhere"something"isthenameoftheapplication,libraryorwebserviceyouwanttointegratewithMopidy.
So,forexample,ifyouplantoaddsupportforaservicenamedSoundspottoMopidy,youwouldnameyourextension'sPythonpackagemopidy_soundspot.
Theextensionmustbeshippedwithasetup.
pyleandberegisteredonPyPI.
ThenameofthedistributiononPyPIwouldbesomethinglike"Mopidy-Soundspot".
Makesuretoincludethename"Mopidy"somewhereinthatnameandthatyoucheckthecapitalization.
ThisisthenameuserswillusewhentheyinstallyourextensionfromPyPI.
MopidyextensionsmustbelicensedunderanApache2.
0(likeMopidyitself),BSD,MITormoreliberallicensetobeabletobeenlistedintheMopidydocumentation.
ThelicensetextshouldbeincludedintheLICENSEleintherootoftheextension'sGitrepo.
Combiningthistogether,wegetthefollowingfolderstructureforourextension,Mopidy-Soundspot:mopidy-soundspot/#TheGitreporootLICENSE#ThelicensetextMANIFEST.
in#ListofdatafilestoincludeinPyPIpackageREADME.
rst#Documentwhatitisandhowtouseitmopidy_soundspot/#Yourcode__init__.
pyext.
conf#Defaultconfigfortheextension.
.
.
setup.
py#InstallationscriptExamplecontentforthemostimportantlesfollowsbelow.
129MopidyDocumentation,Release3.
1.
1-1-gf17acacf21.
2cookiecutterprojecttemplateWe'vealsomadeacookiecutterprojecttemplateforcreatingnewMopidyextensions.
Ifyouinstallcookiecutterandrunasinglecommand,you'reaskedafewquestionsaboutthenameofyourextension,etc.
Thisisusedtocreateafolderstructuresimilartotheabove,withalltheneededlesandmostofthedetailslledinforyou.
Thissavesyoualotoftediousworkandcopy-pastingfromthishowto.
Seethereadmeofcookiecutter-mopidy-extforfurtherdetails.
21.
3ExampleREADME.
rstTheREADMEleshouldquicklyexplainwhattheextensiondoes,howtoinstallit,andhowtocongureit.
Itshouldalsocontainalinktoatarballofthelatestdevelopmentversionoftheextension.
It'simportantthatthislinkendswith#egg=Mopidy-Something-devforinstallationusingpipinstallMopidy-Something==devtowork.
Mopidy-Soundspot`Mopidy`_extensionforplayingmusicfrom`Soundspot`_.
RequiresaSoundspotPlatinasubscriptionandthepysoundspotlibrary.
InstallationInstallbyrunning::sudopipinstallMopidy-SoundspotOr,ifavailable,installtheDebian/Ubuntupackagefrom`apt.
mopidy.
com`_.
ConfigurationBeforestartingMopidy,youmustaddyourSoundspotusernameandpasswordtotheMopidyconfigurationfile::[soundspot]username=alicepassword=secretProjectresources-`Sourcecode`_-`Issuetracker`_-`Developmentbranchtarball`_Changelog(continuesonnextpage)130Chapter21.
ExtensiondevelopmentMopidyDocumentation,Release3.
1.
1-1-gf17acacf(continuedfrompreviouspage)v0.
1.
0(2013-09-17)-Initialrelease.
21.
4Examplesetup.
pyThesetup.
pylemustusesetuptools,andnotdistutils.
ThisisbecauseMopidyextensionsusesetuptools'entrypointfunctionalitytoregisterthemselvesasavailableMopidyextensionswhentheyareinstalledonyoursystem.
Theexamplebelowalsoincludesacoupleofconvenienttricksforreadingthepackageversionfromthesourcecodesothatitisdenedinasingleplace,andtoreusetheREADMEleasthelongdescriptionofthepackageforthePyPIregistration.
Thepackagemusthaveinstall_requiresonsetuptoolsandMopidy>=0.
14(oranewerversion,ifyourextensionrequiresit),inadditiontoanyotherdependenciesrequiredbyyourextension.
IfyouimplementaMopidyfrontendorbackend,you'llneedtoincludePykka>=1.
1intherequirements.
Theentry_pointspartmustbeincluded.
Themopidy.
extpartcannotbechanged,buttheinnermoststringshouldbechanged.
It'sformatisext_name=package_name:Extension.
ext_nameshouldbeashortnameforyourextension,typicallythepartafter"Mopidy-"inlowercase.
Thisnameisusede.
g.
tonamethecongsectionforyourextension.
Thepackage_name:ExtensionpartissimplythePythonpathtotheextensionclassthatwillconnecttherestofthedots.
importrefromsetuptoolsimportsetup,find_packagesdefget_version(filename):content=open(filename).
read()metadata=dict(re.
findall("__([a-z]content))returnmetadata['version']setup(name='Mopidy-Soundspot',version=get_version('mopidy_soundspot/__init__.
py'),url='https://github.
com/your-account/mopidy-soundspot',license='ApacheLicense,Version2.
0',author='YourName',author_email='your-email@example.
com',description='Veryshortdescription',long_description=open('README.
rst').
read(),packages=find_packages(exclude=['tests','tests.
*']),zip_safe=False,include_package_data=True,install_requires=['setuptools','Mopidy>=0.
14','Pykka>=1.
1','pysoundspot',],entry_points={(continuesonnextpage)21.
4.
Examplesetup.
py131MopidyDocumentation,Release3.
1.
1-1-gf17acacf(continuedfrompreviouspage)'mopidy.
ext':['soundspot=mopidy_soundspot:Extension',],},classifiers=['Environment::NoInput/Output(Daemon)','IntendedAudience::EndUsers/Desktop','License::OSIApproved::ApacheSoftwareLicense','OperatingSystem::OSIndependent','ProgrammingLanguage::Python::2','Topic::Multimedia::Sound/Audio::Players',],)TomakesureyourREADME,licenseleanddefaultcongleisincludedinthepackagethatisuploadedtoPyPI,we'llalsoneedtoaddaMANIFEST.
inle:includeLICENSEincludeMANIFEST.
inincludeREADME.
rstincludemopidy_soundspot/ext.
confFordetailsontheMANIFEST.
inleformat,checkoutthedistutilsdocs.
check-manifestisaveryusefultooltocheckyourMANIFEST.
inleforcompleteness.
21.
5Example__init__.
pyThe__init__.
pyleshouldbeplacedinsidethemopidy_soundspotPythonpackage.
TherootofyourPythonpackageshouldhavean__version__attributewithaPEP386compliantversionnumber,forexample"0.
1".
Next,itshouldhaveaclassnamedExtensionwhichinheritsfromMopidy'sextensionbaseclass,mopidy.
ext.
Extension.
Thisistheclassreferredtointheentry_pointspartofsetup.
py.
Anyimportsofotherlesinyourextension,outsideofMopidyandit'scorerequirements,shouldbekeptinsidemethods.
ThisensuresthatthislecanbeimportedwithoutraisingImportErrorexceptionsformissingdependencies,etc.
Thedefaultcongurationfortheextensionisdenedbytheget_default_config()methodintheExtensionclasswhichreturnsaConfigParsercompatiblecongsection.
Thecongsection'snamemustbethesameastheextension'sshortname,asdenedintheentry_pointspartofsetup.
py,forexamplesoundspot.
Allextensionsmustincludeanenabledcongwhichnormallyshoulddefaulttotrue.
Providegooddefaultsforallcongvaluessothatasfewusersaspossiblewillneedtochangethem.
Theexceptionisifthecongvaluehassecurityimplications;inthatcaseyoushoulddefaulttothemostsecureconguration.
Leaveanycongurationsthatdon'thavemeaningfuldefaultsblank,likeusernameandpassword.
Intheexamplebelow,we'vechosentomaintainthedefaultcongasaseparatelenamedext.
conf.
Thismakesiteasytoincludethedefaultcongindocumentationwithoutduplicatingit.
Thisismopidy_soundspot/__init__.
py:importloggingimportosfrommopidyimportconfig,exceptions,ext__version__='0.
1'(continuesonnextpage)132Chapter21.
ExtensiondevelopmentMopidyDocumentation,Release3.
1.
1-1-gf17acacf(continuedfrompreviouspage)#Ifyouneedtolog,useloggersnamedafterthecurrentPythonmodulelogger=logging.
getLogger(__name__)classExtension(ext.
Extension):dist_name='Mopidy-Soundspot'ext_name='soundspot'version=__version__defget_default_config(self):conf_file=os.
path.
join(os.
path.
dirname(__file__),'ext.
conf')returnconfig.
read(conf_file)defget_config_schema(self):schema=super(Extension,self).
get_config_schema()schema['username']=config.
String()schema['password']=config.
Secret()returnschemadefget_command(self):from.
commandsimportSoundspotCommandreturnSoundspotCommand()defvalidate_environment(self):#Anymanualchecksoftheenvironmenttofailearly.
#Dependenciesdescribedbysetup.
pyarecheckedbyMopidy,soyou#shouldnotchecktheirpresencehere.
passdefsetup(self,registry):#Youwilltypicallyonlydooneofthefollowingthingsina#singleextension.
#Registerafrontendfrom.
frontendimportSoundspotFrontendregistry.
add('frontend',SoundspotFrontend)#Registerabackendfrom.
backendimportSoundspotBackendregistry.
add('backend',SoundspotBackend)#Ornothingtoregistere.
g.
commandextensionpassAndthisismopidy_soundspot/ext.
conf:[soundspot]enabled=trueusername=password=Formoredetaileddocumentationontheextensionclass,seethemopidy.
ext–ExtensionAPI.
21.
5.
Example__init__.
py133MopidyDocumentation,Release3.
1.
1-1-gf17acacf21.
6ExamplefrontendIfyouwanttouseMopidy'scoreAPIfromyourextension,thenyouwanttoimplementafrontend.
Theskeletonofafrontendwouldlooklikethis.
NoticethatthefrontendgetspassedareferencetothecoreAPIwhenit'screated.
SeetheFrontendAPIformoredetails.
importpykkafrommopidyimportcoreclassSoundspotFrontend(pykka.
ThreadingActor,core.
CoreListener):def__init__(self,config,core):super(SoundspotFrontend,self).
__init__()self.
core=core#Yourfrontendimplementation21.
7ExamplebackendIfyouwanttoextendMopidytosupportnewmusicandplaylistsources,youwanttoimplementabackend.
AbackenddoesnothaveaccesstoMopidy'scoreAPIatall,butitdoeshaveabunchofinterfacesitcanimplementtoextendMopidy.
Theskeletonofabackendwouldlooklikethis.
Seemopidy.
backend—BackendAPIformoredetails.
importpykkafrommopidyimportbackendclassSoundspotBackend(pykka.
ThreadingActor,backend.
Backend):def__init__(self,config,audio):super(SoundspotBackend,self).
__init__()self.
audio=audio#Yourbackendimplementation21.
8ExamplecommandIfyouwanttoextendtheMopidywithanewhelpernotrunfromtheserver,suchasscanningformedia,addingacommandisthewaytogo.
Yourtoplevelcommandnamewillalwaysmatchyourextensionname,butyouarefreetoaddsub-commandswithnamesofyourchoosing.
Theskeletonofacommandwouldlooklikethis.
Seemopidy.
commands—CommandsAPIformoredetails.
frommopidyimportcommandsclassSoundspotCommand(commands.
Command):help='Sometextthatwillshowupin--help'(continuesonnextpage)134Chapter21.
ExtensiondevelopmentMopidyDocumentation,Release3.
1.
1-1-gf17acacf(continuedfrompreviouspage)def__init__(self):super(SoundspotCommand,self).
__init__()self.
add_argument('--foo')defrun(self,args,config,extensions):#Yourcommandimplementationreturn021.
9ExamplewebapplicationAsofMopidy0.
19,extensionscanuseMopidy'sbuilt-inwebservertohoststaticwebclientsaswellasTornadoandWSGIwebapplications.
Forseveralexamples,seetheHTTPserversideAPIdocsorexplorewiththeMopidy-API-Explorerextension.
21.
10RunninganextensionOnceyourextensionisreadytogo,toseeitinactionyou'llneedtoregisteritwithMopidy.
Typicallythisisdonebyrunningpythonsetup.
pyinstallfromyourextension'sGitreporootdirectory.
Whiledevelopingyourex-tensionandtoavoiddoingthiseverytimeyoumakeachange,youcaninsteadrunpythonsetup.
pydeveloptoeffectivelylinkMopidydirectlywithyourdevelopmentles.
21.
11PythonconventionsIngeneral,itwouldbeniceifMopidyextensionsfollowedthesameCodestyleasMopidyitself,asthey'repartofthesameecosystem.
21.
12UseofMopidyAPIsWhenwritinganextension,youshouldonlyuseAPIsdocumentedatAPIreference.
OtherpartsofMopidy,likemopidy.
internal,maychangeatanytimeandarenotsomethingextensionsshoulduse.
Mopidyperformstypecheckingtohelpcatchextensionbugs.
Thisappliestobothfrontendcallsintocoreandreturnvaluesfrombackends.
Additionallymodeleldsalwaysgetvalidatedtofurtherguardagainstbaddata.
21.
13LogginginextensionsForserverslikeMopidy,loggingisessentialforunderstandingwhat'sgoingon.
WeusetheloggingmodulefromPython'sstandardlibrary.
Whencreatingalogger,alwaysnamespacetheloggerusingyourPythonpackagenameasthiswillbevisibleinMopidy'sdebuglog:importlogginglogger=logging.
getLogger('mopidy_soundspot')(continuesonnextpage)21.
9.
Examplewebapplication135MopidyDocumentation,Release3.
1.
1-1-gf17acacf(continuedfrompreviouspage)#Orevenbetter,usethePythonmodulenameastheloggername:logger=logging.
getLogger(__name__)Whenloggingatlogginglevelinfoorhigher(i.
e.
warning,error,andcritical,butnotdebug)thelogmessagewillbedisplayedtoallMopidyusers.
Thus,thelogmessagesatthoselevelsshouldbewellwrittenandeasytounderstand.
AstheloggernameisnotincludedinMopidy'sdefaultloggingformat,youshouldmakeitobviousfromthelogmessagewhoisthesourceofthelogmessage.
Forexample:Loaded17SoundspotplaylistsIsmuchbetterthan:Loaded17playlistsIfyouwanttoturnondebugloggingforyourownextension,butnotforeverythingelseduetotheamountofnoise,seethedocsfortheloglevels/*congsection.
21.
14MakingHTTPrequestsfromextensionsManyMopidyextensionsneedtomakeHTTPrequeststousesomewebAPI.
Here'safewrecommendationstothoseextensions.
21.
14.
1ProxiesIfyoumakeHTTPrequestspleasemakesuretorespecttheproxycongs,sothatalltherequestsyoumakegothroughtheproxyconguredbytheMopidyuser.
Tomakethiseasierforextensiondevelopers,thehelperfunctionmopidy.
httpclient.
format_proxy()wasaddedinMopidy1.
1.
ThisfunctionreturnstheproxysettingsformattedthewayRequestsexpects.
21.
14.
2User-AgentstringsWhenyoumakeHTTPrequests,it'shelpfulfordebuggingandusageanalysisiftheclientidentiesitselfwithaproperUser-Agentstring.
InMopidy1.
1,weaddedthehelperfunctionmopidy.
httpclient.
format_user_agent().
Here'sanexampleofhowtouseit:>>>frommopidyimporthttpclient>>>importmopidy_soundspot>>>httpclient.
format_user_agent(.
.
.
f'{mopidy_soundspot.
Extension.
dist_name}/'.
.
.
f'{mopidy_soundspot.
__version__}'.
.
.
)'Mopidy-SoundSpot/2.
0.
0Mopidy/3.
0.
0Python/3.
7.
5'136Chapter21.
ExtensiondevelopmentMopidyDocumentation,Release3.
1.
1-1-gf17acacf21.
14.
3ExampleusingRequestssessionsMostMopidyextensionsthatmakeHTTPrequestsusetheRequestslibrarytodoso.
WhenusingRequests,themostconvenientwaytomakesuretheproxyandUser-AgentheaderissetproperlyistocreateaRequestssessionobjectandusethatobjecttomakeallyourHTTPrequests:frommopidyimporthttpclientimportrequestsimportmopidy_soundspotdefget_requests_session(proxy_config,user_agent):proxy=httpclient.
format_proxy(proxy_config)full_user_agent=httpclient.
format_user_agent(user_agent)session=requests.
Session()session.
proxies.
update({'http':proxy,'https':proxy})session.
headers.
update({'user-agent':full_user_agent})returnsession#``mopidy_config``istheconfigobjectpassedtoyourfrontend/backend#constructorsession=get_requests_session(proxy_config=mopidy_config['proxy'],user_agent=(f'{mopidy_soundspot.
Extension.
dist_name}/{mopidy_soundspot.
__version__}'))response=session.
get('http://example.
com')#Nowdosomethingwith``response``and/ormakefurtherrequestsusingthe#``session``object.
Forfurtherdetails,seeRequests'docsonsessionobjects.
21.
15TestingextensionsCreatingtestcasesforyourextensionsmakesthemmuchsimplertomaintainoverthelongterm.
Itcanalsomakeiteasierforyoutoreviewandacceptpullrequestsfromothercontributorsknowingthattheywillnotbreaktheextensioninsomeunanticipatedway.
Beforegettingstarted,itisimportanttofamiliarizeyourselfwiththePythonmocklibrary.
Whenitcomestorunningtests,Mopidytypicallymakesuseoftestingtoolsliketoxandpytest.
21.
15.
Testingextensions137MopidyDocumentation,Release3.
1.
1-1-gf17acacf21.
15.
1TestingapproachToalargeextentthetestingapproachtofollowdependsonhowyourextensionisstructured,whichpartsofMopidyitinteractswith,andifitusesany3rdpartyAPIsormakesanyHTTPrequeststotheoutsideworld.
Thesectionsthatfollowcontaincodeextractsthathighlightsomeofthekeyareasthatshouldbetested.
Formoreexhaustiveexamples,youmaywanttotakealookatthetestcasesthatshipwithMopidyitselfwhichcoverseverythingfrominstantiatingvariouscontrollers,readingcongurationles,andsimulatingeventsthatyourextensioncanlistento.
Ingeneralyourtestsshouldcovertheextensiondenition,therelevantMopidycontrollers,andthePykkabackendand/orfrontendactorsthatformpartoftheextension.
21.
15.
2TestingtheextensiondenitionTestcasesforcheckingthedenitionoftheextensionshouldensurethat:theextensionprovidesaext.
confcongurationlecontainingtherelevantparameterswiththeirdefaultvalues,thatthecongschemaisfullydened,andthattheextension'sactor(s)areaddedtotheMopidyregistryonsetup.
Anexampleofwhatthesetestscouldlooklikeisprovidedbelow:deftest_get_default_config():ext=Extension()config=ext.
get_default_config()assert'[my_extension]'inconfigassert'enabled=true'inconfigassert'param_1=value_1'inconfigassert'param_2=value_2'inconfigassert'param_n=value_n'inconfigdeftest_get_config_schema():ext=Extension()schema=ext.
get_config_schema()assert'enabled'inschemaassert'param_1'inschemaassert'param_2'inschemaassert'param_n'inschemadeftest_setup():registry=mock.
Mock()ext=Extension()ext.
setup(registry)calls=[mock.
call('frontend',frontend_lib.
MyFrontend),mock.
call('backend',backend_lib.
MyBackend)]registry.
add.
assert_has_calls(calls,any_order=True)138Chapter21.
ExtensiondevelopmentMopidyDocumentation,Release3.
1.
1-1-gf17acacf21.
15.
3TestingbackendactorsBackendscanusuallybeconstructedwithasmallmockupofthecongurationle,andmockingtheaudioactor:@pytest.
fixturedefconfig():return{'http':{'hostname':'127.
0.
0.
1','port':'6680'},'proxy':{'hostname':'host_mock','port':'port_mock'},'my_extension':{'enabled':True,'param_1':'value_1','param_2':'value_2','param_n':'value_n',}}defget_backend(config):returnbackend.
MyBackend(config=config,audio=mock.
Mock())ThefollowinglibrariesmightbeusefulformockinganyHTTPrequeststhatyourextensionmakes:responses-AutilitylibraryformockingouttherequestsPythonlibrary.
vcrpy-AutomaticallymockyourHTTPinteractionstosimplifyandspeeduptesting.
Attheveryleast,you'llprobablywanttopatchrequestsoranyotherwebAPI'sthatyouusetoavoidanyunin-tendedHTTPrequestsfrombeingmadebyyourbackendduringtesting:frommockimportpatch@mock.
patch('requests.
get',mock.
Mock(side_effect=Exception('InterceptedunintendedHTTPcall')))Backendtestsshouldalsoensurethat:thebackendprovidesauniqueURIscheme,thatitsetsupthevariousproviders(e.
g.
library,playback,etc.
)deftest_uri_schemes(config):backend=get_backend(config)assert'my_scheme'inbackend.
uri_schemesdeftest_init_sets_up_the_providers(config):backend=get_backend(config)assertisinstance(backend.
library,library.
MyLibraryProvider)assertisinstance(backend.
playback,playback.
MyPlaybackProvider)Onceyouhaveabackendinstancetoworkwith,testingthevariousplayback,library,andotherprovidersisstraightforwardandshouldnotrequireanyspecialsetuporprocessing.
21.
15.
Testingextensions139MopidyDocumentation,Release3.
1.
1-1-gf17acacf21.
15.
4TestinglibrariesLibrarytestcasesshouldcovertheimplementationsofthestandardMopidyAPI(e.
g.
browse,lookup,refresh,get_images,search,etc.
)21.
15.
5TestingplaybackcontrollersTestingchange_trackandtranslate_uriisprobablythehighestpriority,sincethesemethodsareusedtopreparethetrackandprovideitsaudioURLtoMopidy'scoreforplayback.
21.
15.
6TestingfrontendsBecausemostfrontendswillinteractwiththeMopidycore,itwillmostlikelybenecessarytohaveafullcorerunningfortestingpurposes:self.
core=core.
Core.
start(config,backends=[get_backend(config)]).
proxy()ItmaybeadvisabletotakeaquicklookatthePykkaAPIatthispointtomakesurethatyouarefamiliarwithThreadingActor,ThreadingFuture,andtheproxiesthatallowyoutoaccesstheattributesandmethodsoftheactordirectly.
You'llalsoneedalistofTrackandalistofURIsinordertopopulatethecorewithsomesimpletracksthatcanbeusedfortesting:classBaseTest(unittest.
TestCase):tracks=[models.
Track(uri='my_scheme:track:id1',length=40000),#Regulartrackmodels.
Track(uri='my_scheme:track:id2',length=None),#Noduration]uris=['my_scheme:track:id1','my_scheme:track:id2']Inthesetup()methodofyourtestclass,youwillthenprobablyneedtomonkeypatchlookinguptracksinthelibrary(sothatitwillalwaysusetheliststhatyoudened),andthenpopulatethecore'stracklist:deflookup(uris):result={uri:[]foruriinuris}fortrackinself.
tracks:iftrack.
uriinresult:result[track.
uri].
append(track)returnresultself.
core.
library.
lookup=lookupself.
tl_tracks=self.
core.
tracklist.
add(uris=self.
uris).
get()Withallofthatdoneyoushouldnallybereadytoinstantiateyourfrontend:self.
frontend=frontend.
MyFrontend.
start(config(),self.
core).
proxy()Keepinmindthatthenormalcoreandfrontendmethodswillusuallyreturnpykka.
ThreadingFutureobjects,soyouwillneedtoadd.
get()attheendofmostmethodcallsinordertogettotheactualreturnvalues.
140Chapter21.
ExtensiondevelopmentMopidyDocumentation,Release3.
1.
1-1-gf17acacf21.
15.
7TriggeringeventsTheremaybetestcasescenariosthatrequiresimulatingcertaineventtriggersthatyourextension'sactorscanlistenforandrespondon.
Anexampleforpatchingthelistenertostoretheseevents,andthenplaythembackforyouractor,maylooksomethinglikethis:self.
events=[]self.
patcher=mock.
patch('mopidy.
listener.
send')self.
send_mock=self.
patcher.
start()defsend(cls,event,**kwargs):self.
events.
append((event,kwargs))self.
send_mock.
side_effect=sendOncealloftheeventshavebeencaptured,amethodlikereplay_events()canbecalledattherelevantpointsinthecodetohavetheeventsre:defreplay_events(self,my_actor,until=None):whileself.
events:ifself.
events[0][0]==until:breakevent,kwargs=self.
events.
pop(0)frontend.
on_event(event,**kwargs).
get()Forfurtherdetailsandexamples,refertothe/testsdirectoryontheMopidydevelopmentbranch.
21.
15.
Testingextensions141MopidyDocumentation,Release3.
1.
1-1-gf17acacf142Chapter21.
ExtensiondevelopmentCHAPTERTWENTYTWOCODESTYLEAllprojectsintheMopidyorganizationfollowsthefollowingcodestyle:AutomaticallyformatallcodewithBlack.
UseBlack'sstringnormalization,whichprefers"quotesover',unlessthestringcontains".
Automaticallysortimportsusingisort.
FollowPEP8.
Runake8tocheckyourcodeagainsttheguidelines.
ThestrictadherencetoBlackandake8areenforcedbyourCIsetup.
Pullrequeststhatdonotpassthesecheckswillnotbemerged.
Formoregeneraladvise,takealookatPEP20foranicepeekintoageneralmindsetusefulforPythoncoding.
143MopidyDocumentation,Release3.
1.
1-1-gf17acacf144Chapter22.
CodestyleCHAPTERTWENTYTHREERELEASEPROCEDURESHerewetrytokeepanuptodaterecordofhowMopidyreleasesaremade.
Thisdocumentationservesbothasachecklist,toreducetheproject'sdependencyonkeyindividuals,andasasteppingstonetomoreautomation.
23.
1ReleasingextensionsExtensionsthataremaintainedintheMopidyorganizationuseaquitestream-linedreleaseprocedure.
1.
MakesurethateverythinghasbeenmergedintothemasterbranchonGitHub,andthatallCIchecksaregreen.
2.
Performanymanualtestsyoufeelarerequired.
3.
Bumptheversioninsetup.
cfginlinewithourstrategy.
Forexample,to2.
0.
2.
4.
Committhebumpedversion:gitcommit-m"Releasev2.
0.
2"5.
Tagthecommit:gittag-m"Releasev2.
0.
2"v2.
0.
2Itisencouragedtouse-stosignthetagifyouhaveaGnuPGsetup.
6.
PushtoGitHub:gitpushoriginmaster--follow-tags7.
GototheGitHubrepository'stagspage,e.
g.
https://github.
com/mopidy/mopidy-foo/tags.
Findthetagandselect"Createrelease"inthetag'sdropdownmenu.
8.
Copythetag,e.
g.
v2.
0.
2intothe"title"eld.
Writeachangelogentryinthedescriptioneld,andhit"Publishrelease".
9.
GitHubActionsnowbuildsthepackageanduploadsittoPyPI.
Thisprocedurehasseveralbenets:Everyonewithcommitaccesscanmakereleases.
Noone,exceptthosewithdirectPyPIaccess,canmakereleaseswithoutalsoleavingthesourcecodeofwhattheyreleasedpubliclyavailableonGitHub,creatinganauditlogincaseofanymaliciousactions.
Thechangelogcanbeamendedpost-releasethroughtheGitHubReleasesUI.
145MopidyDocumentation,Release3.
1.
1-1-gf17acacfTheprimarydrawbackofthisprocedureisthatthereisnoobviouswaytomaintainachangelogin-betweenreleases.
Thepreferredsolutionistomakereleasesoften,sothatwritingupachangelogfromtherecentGitcommitsisdoneinaminuteortwo.
23.
1.
1HowtosetupthisreleaseworkowIfyoumaintainaMopidyextension,you'reencouragedtoadoptthesameprocedure.
Tosetupthisonyourownrepo,youmust:1.
Copy.
github/workflows/release.
ymlfromtheMopidycookiecutterproject.
2.
CreateanAPItokeninyouraccountsettingsatPyPIwithscopetoaccesstheextension'sPyPIpackage.
3.
CopythetokentoanewsecretcalledPYPI_TOKENinyourGitHubrepo'ssettings.
Ignorethesectiontitled"Usingthistoken"onPyPI.
Withtherelease.
ymlleandthePYPI_TOKENsecretinplace,releasesshouldautomaticallybeuploadedtoPyPIwhenyoufollowtheprocedureabove.
23.
2ReleasingMopidyitselfMopidyitselfisabitmorecomplicatedthanextensionsbecausethechangelogismaintainedintheGitrepo,andbecausewemaintainmultiplebranchestobeabletoworktowardsthenextbugxreleaseandthenextfeaturereleaseatthesametime.
23.
2.
1Preparations1.
Updatethechangelog.
Commitandpushit.
2.
MakesurethateverythinghasbeenmergedintothedevelopbranchonGitHub,andthatallCIchecksaregreen.
3.
Performanymanualtestsyoufeelarerequired.
23.
2.
2Release1.
Bumptheversioninsetup.
cfginlinewithourstrategy.
Forexample,to3.
3.
0,andsetthereleasedateinthechangelog.
2.
Committhebumpedversionandreleasedate:gitcommit-m"Preparereleaseofv3.
3.
0"3.
Mergethereleasebranch(developintheexample)intomaster:gitcheckoutmastergitpullgitmerge--no-ff-m"Releasev3.
3.
0"develop4.
Tagthecommit:gittag-m"Releasev3.
3.
0"v3.
3.
0Itisencouragedtouse-stosignthetagifyouhaveaGnuPGsetup.
146Chapter23.
ReleaseproceduresMopidyDocumentation,Release3.
1.
1-1-gf17acacf5.
PushtoGitHub:gitpushoriginmaster--follow-tags6.
GototheGitHubrepository'stagspageathttps://github.
com/mopidy/mopidy/tags.
Findthetagandselect"Createrelease"inthetag'sdropdownmenu.
7.
Copythetag,e.
g.
v3.
3.
0intothe"title"eld.
Writeachangelogentryinthedescriptioneld,andhit"Publishrelease".
8.
GitHubActionsnowbuildsthepackageanduploadsittoPyPI.
23.
2.
3Post-release1.
Toprepareforfurtherdevelopment,mergethemasterbranchbackintothedevelopbranchandpushittoGitHub:gitcheckoutdevelopgitmergemastergitpushorigindevelop2.
MakesurethenewtagisbuiltbyReadtheDocs,andthatthe"latest"versionshowsthenewlyreleasedversion.
3.
SpreadthewordthroughanannouncementpostontheDiscourseforum.
4.
Notifydistributionpackagers,includingbutnotlimitedto:ArchLinuxDebianHomebrew23.
2.
ReleasingMopidyitself147MopidyDocumentation,Release3.
1.
1-1-gf17acacf148Chapter23.
ReleaseproceduresCHAPTERTWENTYFOURAPIREFERENCENote:OnlyAPIsdocumentedherearepublicandopenforusebyMopidyextensions.
24.
1Concepts24.
1.
1ArchitectureTheoverallarchitectureofMopidyisorganizedaroundmultiplefrontendsandbackends.
ThefrontendsusethecoreAPI.
Thecoreactormakesmultiplebackendsworkasone.
Thebackendsconnecttovariousmusicsources.
Thecoreactorusethemixeractortocontrolvolume,whilethebackendsusetheaudioactortoplayaudio.
149MopidyDocumentation,Release3.
1.
1-1-gf17acacfFrontendsFrontendsexposeMopidytotheexternalworld.
TheycanimplementserversforprotocolslikeHTTP,MPDandMPRIS,andtheycanbeusedtoupdateotherserviceswhensomethinghappensinMopidy,liketheLast.
fmscrobblerfrontenddoes.
SeeFrontendAPIformoredetails.
CoreThecoreisorganizedasasetofcontrollerswithresponsiblityforseparatesetsoffunctionality.
Thecoreisthesingleactorthatthefrontendssendtheirrequeststo.
Foreveryrequestfromafrontenditcallsouttooneormorebackendswhichdoestherealwork,andwhenthebackendsrespond,thecoreactorisresponsibleforcombiningtheresponsesintoasingleresponsetotherequestingfrontend.
Thecoreactoralsokeepstrackofthetracklist,sinceitdoesn'tbelongtoaspecicbackend.
Seemopidy.
core—CoreAPIformoredetails.
150Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfBackendsThebackendsareorganizedasasetofproviderswithresponsiblityforseparatesetsoffunctionality,similartothecoreactor.
Anythingspecictoi.
e.
Spotifyintegrationorlocalstorageiscontainedinthebackends.
Tointegratewithnewmusicsources,youjustaddanewbackend.
Seemopidy.
backend—BackendAPIformoredetails.
AudioTheaudioactorisathinwrapperaroundthepartsoftheGStreamerlibraryweuse.
Ifyouimplementanadvancedbackend,youmayneedtoimplementyourownplaybackproviderusingthemopidy.
audio—AudioAPI,butmostbackendscanusethedefaultplaybackproviderwithoutanychanges.
MixerThemixeractorisresponsibleforvolumecontrolandmuting.
Thedefaultmixerusetheaudioactortocontrolvolumeinsoftware.
Thealternativeimplementationsaretypicallyindependentoftheaudioactor,butinsteadusesomethirdpartyPythonlibraryoraserialinterfacetocontrolotherformsofvolumecontrols.
24.
1.
2mopidy.
models—DatamodelsTheseimmutabledatamodelsareusedforalldatatransferwithintheMopidybackendsandbetweenthebackendsandtheMPDfrontend.
Alleldsareoptionalandimmutable.
Inotherwords,theycanonlybesetthroughtheclassconstructorduringinstancecreation.
Additionallyeldsaretypechecked.
Ifyouwanttomodifyamodel,usethereplace()method.
Itacceptskeywordargumentsforthepartsofthemodelyouwanttochange,andcopiestherestofthedatafromthemodelyoucalliton.
Example:>>>frommopidy.
modelsimportTrack>>>track1=Track(name='ChristmasCarol',length=171)>>>track1Track(artists=[],length=171,name='ChristmasCarol')>>>track2=track1.
replace(length=37)>>>track2(continuesonnextpage)24.
1.
Concepts151MopidyDocumentation,Release3.
1.
1-1-gf17acacf(continuedfrompreviouspage)Track(artists=[],length=37,name='ChristmasCarol')>>>track1Track(artists=[],length=171,name='ChristmasCarol')DatamodelrelationsDatamodelAPIclassmopidy.
models.
Ref(*args,**kwargs)ModeltorepresentURIreferenceswithahumanfriendlynameandtypeattached.
Thisisintendedforusealightweightobject"free"ofmetadatathatcanbepassedaroundinsteadofusingfullblownmodels.
Parametersuri(string)–objectURIname(string)–objectnametype(string)–objecttypeALBUM='album'Constantusedforcomparisonwiththetypeeld.
152Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfARTIST='artist'Constantusedforcomparisonwiththetypeeld.
DIRECTORY='directory'Constantusedforcomparisonwiththetypeeld.
PLAYLIST='playlist'Constantusedforcomparisonwiththetypeeld.
TRACK='track'Constantusedforcomparisonwiththetypeeld.
classmethodalbum(**kwargs)CreateaRefwithtypeALBUM.
classmethodartist(**kwargs)CreateaRefwithtypeARTIST.
classmethoddirectory(**kwargs)CreateaRefwithtypeDIRECTORY.
nameTheobjectname.
Read-only.
classmethodplaylist(**kwargs)CreateaRefwithtypePLAYLIST.
classmethodtrack(**kwargs)CreateaRefwithtypeTRACK.
typeTheobjecttype,e.
g.
"artist","album","track","playlist","directory".
Read-only.
uriTheobjectURI.
Read-only.
classmopidy.
models.
Track(*args,**kwargs)Parametersuri(string)–trackURIname(string)–tracknameartists(listofArtist)–trackartistsalbum(Album)–trackalbumcomposers(listofArtist)–trackcomposersperformers(listofArtist)–trackperformersgenre(string)–trackgenretrack_no(integerorNoneifunknown)–tracknumberinalbumdisc_no(integerorNoneifunknown)–discnumberinalbumdate(string)–trackreleasedate(YYYYorYYYY-MM-DD)length(integerorNoneifthereisnoduration)–tracklengthinmillisecondsbitrate(integer)–bitrateinkbit/scomment(string)–trackcommentmusicbrainz_id(string)–MusicBrainzID24.
1.
Concepts153MopidyDocumentation,Release3.
1.
1-1-gf17acacflast_modified(integerorNoneifunknown)–RepresentslastmodicationtimealbumThetrackAlbum.
Read-only.
artistsAsetoftrackartists.
Read-only.
bitrateThetrack'sbitrateinkbit/s.
Read-only.
commentThetrackcomment.
Read-only.
composersAsetoftrackcomposers.
Read-only.
dateThetrackreleasedate.
Read-only.
disc_noThediscnumberinthealbum.
Read-only.
genreThetrackgenre.
Read-only.
last_modifiedIntegerrepresentingwhenthetrackwaslastmodied.
Exactmeaningdependsonsourceoftrack.
ForlocallesthisisthemodicationtimeinmillisecondssinceUnixepoch.
Forotherbackendsitcouldbeanequivalenttimestamporsimplyaversioncounter.
lengthThetracklengthinmilliseconds.
Read-only.
musicbrainz_idTheMusicBrainzIDofthetrack.
Read-only.
nameThetrackname.
Read-only.
performersAsetoftrackperformers`.
Read-only.
track_noThetracknumberinthealbum.
Read-only.
uriThetrackURI.
Read-only.
classmopidy.
models.
Album(*args,**kwargs)Parametersuri(string)–albumURIname(string)–albumnameartists(listofArtist)–albumartistsnum_tracks(integerorNoneifunknown)–numberoftracksinalbumnum_discs(integerorNoneifunknown)–numberofdiscsinalbumdate(string)–albumreleasedate(YYYYorYYYY-MM-DD)musicbrainz_id(string)–MusicBrainzID154Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfartistsAsetofalbumartists.
Read-only.
dateThealbumreleasedate.
Read-only.
musicbrainz_idTheMusicBrainzIDofthealbum.
Read-only.
nameThealbumname.
Read-only.
num_discsThenumberofdiscsinthealbum.
Read-only.
num_tracksThenumberoftracksinthealbum.
Read-only.
uriThealbumURI.
Read-only.
classmopidy.
models.
Artist(*args,**kwargs)Parametersuri(string)–artistURIname(string)–artistnamesortname(string)–artistnameforsortingmusicbrainz_id(string)–MusicBrainzIDmusicbrainz_idTheMusicBrainzIDoftheartist.
Read-only.
nameTheartistname.
Read-only.
sortnameArtistnameforbettersorting,e.
g.
witharticlesstrippeduriTheartistURI.
Read-only.
classmopidy.
models.
Playlist(*args,**kwargs)Parametersuri(string)–playlistURIname(string)–playlistnametracks(listofTrackelements)–playlist'strackslast_modified(int)–playlist'smodicationtimeinmillisecondssinceUnixepochlast_modifiedTheplaylistmodicationtimeinmillisecondssinceUnixepoch.
Read-only.
Integer,orNoneifunknown.
propertylengthThenumberoftracksintheplaylist.
Read-only.
nameTheplaylistname.
Read-only.
24.
1.
Concepts155MopidyDocumentation,Release3.
1.
1-1-gf17acacftracksTheplaylist'stracks.
Read-only.
uriTheplaylistURI.
Read-only.
classmopidy.
models.
Image(*args,**kwargs)Parametersuri(string)–URIoftheimagewidth(int)–OptionalwidthofimageorNoneheight(int)–OptionalheightofimageorNoneheightOptionalheightoftheimageorNone.
Read-only.
uriTheimageURI.
Read-only.
widthOptionalwidthoftheimageorNone.
Read-only.
classmopidy.
models.
TlTrack(*args,**kwargs)Atracklisttrack.
Wrapsaregulartrackandit'stracklistID.
TheuseofTlTrackallowsthesametracktoappearmultipletimesinthetracklist.
Thisclassalsoacceptsit'sparametersaspositionalarguments.
Bothargumentsmustbeprovided,andtheymustappearintheordertheyarelistedhere.
Thisclassalsosupportsiteration,soyourextractitsvalueslikethis:(tlid,track)=tl_trackParameterstlid(int)–tracklistIDtrack(Track)–thetracktlidThetracklistID.
Read-only.
trackThetrack.
Read-only.
classmopidy.
models.
SearchResult(*args,**kwargs)Parametersuri(string)–searchresultURItracks(listofTrackelements)–matchingtracksartists(listofArtistelements)–matchingartistsalbums(listofAlbumelements)–matchingalbumsalbumsThealbumsmatchingthesearchquery.
Read-only.
artistsTheartistsmatchingthesearchquery.
Read-only.
156Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacftracksThetracksmatchingthesearchquery.
Read-only.
uriThesearchresultURI.
Read-only.
Datamodelhelpersclassmopidy.
models.
ImmutableObject(*args,**kwargs)Superclassforimmutableobjectswhoseeldscanonlybemodiedviatheconstructor.
Thisversionofthisclasshasbeenretainedtoavoidbreakinganyclientsrelyingonit'sbehavior.
InternallyinMopidywenowuseValidatedImmutableObjectfortypesafetyandit'smuchsmallermemoryfootprint.
Parameterskwargs(any)–kwargstosetaseldsontheobjectreplace(**kwargs)ReplacetheeldsinthemodelandreturnanewinstanceExamples:#ReturnsatrackwithanewnameTrack(name='foo').
replace(name='bar')#ReturnanalbumwithanewnumberoftracksAlbum(num_tracks=2).
replace(num_tracks=5)Parameterskwargs(any)–kwargstosetaseldsontheobjectReturntypeinstanceofthemodelwithreplacedeldsclassmopidy.
models.
ValidatedImmutableObject(*args,**kwargs)Superclassforimmutableobjectswhoseeldscanonlybemodiedviatheconstructor.
FieldsshouldbeFieldinstancestoensuretypesafetyinourmodels.
Notethatsincethesemodelscannotbechanged,weheavilymemoizethemtosavememory.
Soconstructingaclasswiththesameargumentstwicewillgiveyouthesameinstancetwice.
replace(**kwargs)ReplacetheeldsinthemodelandreturnanewinstanceExamples:#ReturnsatrackwithanewnameTrack(name='foo').
replace(name='bar')#ReturnanalbumwithanewnumberoftracksAlbum(num_tracks=2).
replace(num_tracks=5)Notethatinternallywememoizeheavilytokeepmemoryusagedowngivenouroverlyrepetitivedatastructures.
Soyoumightgetanexistinginstanceifitcontainsthesamevalues.
Parameterskwargs(any)–kwargstosetaseldsontheobjectReturntypeinstanceofthemodelwithreplacedelds24.
1.
Concepts157MopidyDocumentation,Release3.
1.
1-1-gf17acacfDatamodel(de)serializationmopidy.
models.
model_json_decoder(dct)AutomaticallydeserializeMopidymodelsfromJSON.
Usage:>>>importjson>>>json.
loads(.
.
.
'{"a_track":{"__model__":"Track","name":"name"}}',.
.
.
object_hook=model_json_decoder){u'a_track':Track(artists=[],name=u'name')}classmopidy.
models.
ModelJSONEncoder(*,skipkeys=False,ensure_ascii=True,check_circular=True,allow_nan=True,sort_keys=False,indent=None,separators=None,default=None)AutomaticallyserializeMopidymodelstoJSON.
Usage:>>>importjson>>>json.
dumps({'a_track':Track(name='name')},cls=ModelJSONEncoder)'{"a_track":{"__model__":"Track","name":"name"}}'Datamodeleldtypesclassmopidy.
models.
fields.
Field(default=None,type=None,choices=None)BaseeldforuseinValidatedImmutableObject.
Theseeldsareresponsiblefortypecheckingandotherdatasanitationinourmodels.
ForsimplicityeldsusethePythondescriptorprotocoltostorethevaluesintheinstancedictionary.
Alsonotethateldsaremutableiftheobjecttheyareattachedtoallowit.
DefaultvalueswillbevalidatedwiththeexceptionofNone.
Parametersdefault–defaultvalueforeldtype–ifsettheeldvaluemustbeofthistypechoices–ifsettheeldvaluemustbeoneoftheseclassmopidy.
models.
fields.
String(default=None)SpecializedFieldwhichiswiredupforbytesandunicode.
Parametersdefault–defaultvalueforeldclassmopidy.
models.
fields.
Identifier(default=None)FieldforstoringvaluessuchasGUIDsorotheridentiers.
Valueswillbeinterned.
Parametersdefault–defaultvalueforeldclassmopidy.
models.
fields.
URI(default=None)FieldforstoringURIsValueswillbeinterned,currentlynotvalidated.
158Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfParametersdefault–defaultvalueforeldclassmopidy.
models.
fields.
Date(default=None)FieldforstoringISO8601datesasastring.
SupportedformatsareYYYY-MM-DD,YYYY-MMandYYYY,currentlynotvalidated.
Parametersdefault–defaultvalueforeldclassmopidy.
models.
fields.
Integer(default=None,min=None,max=None)Fieldforstoringintegernumbers.
Parametersdefault–defaultvalueforeldmin–eldvaluemustbelargerorequaltothisvaluewhensetmax–eldvaluemustbesmallerorequaltothisvaluewhensetclassmopidy.
models.
fields.
Collection(type,container=)Fieldforstoringcollectionsofagiventype.
Parameterstype–allitemsstoredinthecollectionmustbeofthistypecontainer–thetypetostoretheitemsin24.
2Basics24.
2.
1mopidy.
core—CoreAPIThecoreAPIistheinterfacethatisusedbyfrontendslikemopidy.
httpandMopidy-MPD.
Thecorelayerisinbetweenthefrontendsandthebackends.
Don'tforgetthatyouwillbeaccessingcoreasaPykkaactor.
IfyouareonlyinterestedinbeingnotiedaboutchangesincoreseeCoreListener.
Changedinversion1.
1:AllcoreAPIcallsarenowtypechecked.
Changedinversion1.
1:Allbackendreturnvaluesarenowtypechecked.
classmopidy.
core.
Core(cong=None,mixer=None,backends=None,audio=None)tracklistManageseverythingrelatedtothelistoftrackswewillplay.
SeeTracklistController.
playbackManagesplaybackstateandthecurrentplayingtrack.
SeePlaybackController.
libraryManagesthemusiclibrary,e.
g.
searchingandbrowsingformusic.
SeeLibraryController.
playlistsManagesstoredplaylists.
SeePlaylistsController.
mixerManagesvolumeandmuting.
SeeMixerController.
historyKeepsrecordofwhattrackshavebeenplayed.
SeeHistoryController.
24.
2.
Basics159MopidyDocumentation,Release3.
1.
1-1-gf17acacfget_uri_schemes()GetlistofURIschemeswecanhandleget_version()GetversionoftheMopidycoreAPITracklistcontrollerclassmopidy.
core.
TracklistController(core)ManipulatingTracklistController.
add(tracks=None,at_position=None,uris=None)Addtrackstothetracklist.
Ifurisisgiveninsteadoftracks,theURIsarelookedupinthelibraryandtheresultingtracksareaddedtothetracklist.
Ifat_positionisgiven,thetracksareinsertedatthegivenpositioninthetracklist.
Ifat_positionisnotgiven,thetracksareappendedtotheendofthetracklist.
Triggersthemopidy.
core.
CoreListener.
tracklist_changed()event.
Parameterstracks(listofmopidy.
models.
TrackorNone)–trackstoaddat_position(intorNone)–positionintracklisttoaddtracksuris(listofstringorNone)–listofURIsfortrackstoaddReturntypelistofmopidy.
models.
TlTrackNewinversion1.
0:Theurisargument.
Deprecatedsinceversion1.
0:Thetracksargument.
Useuris.
TracklistController.
remove(criteria)Removethematchingtracksfromthetracklist.
Usesfilter()tolookupthetrackstoremove.
Triggersthemopidy.
core.
CoreListener.
tracklist_changed()event.
Parameterscriteria(dict,of(string,list)pairs)–oneormorerulestomatchbyReturntypelistofmopidy.
models.
TlTrackthatwereremovedTracklistController.
clear()Clearthetracklist.
Triggersthemopidy.
core.
CoreListener.
tracklist_changed()event.
TracklistController.
move(start,end,to_position)Movethetracksintheslice[start:end]toto_position.
Triggersthemopidy.
core.
CoreListener.
tracklist_changed()event.
Parametersstart(int)–positionofrsttracktomoveend(int)–positionafterlasttracktomove160Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfto_position(int)–newpositionforthetracksTracklistController.
shuffle(start=None,end=None)Shufestheentiretracklist.
Ifstartandendisgivenonlyshufestheslice[start:end].
Triggersthemopidy.
core.
CoreListener.
tracklist_changed()event.
Parametersstart(intorNone)–positionofrsttracktoshufeend(intorNone)–positionafterlasttracktoshufeCurrentstateTracklistController.
get_tl_tracks()Gettracklistaslistofmopidy.
models.
TlTrack.
TracklistController.
index(tl_track=None,tlid=None)Thepositionofthegiventrackinthetracklist.
Ifneithertl_trackortlidisgivenwereturntheindexofthecurrentlyplayingtrack.
Parameterstl_track(mopidy.
models.
TlTrackorNone)–thetracktondtheindexoftlid(intorNone)–TLIDofthetracktondtheindexofReturntypeintorNoneNewinversion1.
1:ThetlidparameterTracklistController.
get_version()Getthetracklistversion.
Integerwhichisincreasedeverytimethetracklistischanged.
IsnotresetbeforeMopidyisrestarted.
TracklistController.
get_length()Getlengthofthetracklist.
TracklistController.
get_tracks()Gettracklistaslistofmopidy.
models.
Track.
TracklistController.
slice(start,end)Returnsasliceofthetracklist,limitedbythegivenstartandendpositions.
Parametersstart(int)–positionofrsttracktoincludeinsliceend(int)–positionafterlasttracktoincludeinsliceReturntypemopidy.
models.
TlTrackTracklistController.
filter(criteria)Filterthetracklistbythegivencriteria.
Eachruleinthecriteriaconsistsofamodeleldandalistofvaluestocompareitagainst.
Ifthemodeleldmatchesanyofthevalues,itmaybereturned.
Onlytracksthatmatchallthegivencriteriaarereturned.
Examples:24.
2.
Basics161MopidyDocumentation,Release3.
1.
1-1-gf17acacf#ReturnstrackswithTLIDs1,2,3,or4(tracklistID)filter({'tlid':[1,2,3,4]})#ReturnstrackwithURIs'xyz'or'abc'filter({'uri':['xyz','abc']})#ReturnstrackwithamatchingTLIDs(1,3or6)anda#matchingURI('xyz'or'abc')filter({'tlid':[1,3,6],'uri':['xyz','abc']})Parameterscriteria(dict,of(string,list)pairs)–oneormorerulestomatchbyReturntypelistofmopidy.
models.
TlTrackFuturestateTracklistController.
get_eot_tlid()TheTLIDofthetrackthatwillbeplayedafterthecurrenttrack.
NotnecessarilythesameTLIDasreturnedbyget_next_tlid().
ReturntypeintorNoneNewinversion1.
1.
TracklistController.
get_next_tlid()Thetlidofthetrackthatwillbeplayedifcallingmopidy.
core.
PlaybackController.
next().
Fornormalplaybackthisisthenexttrackinthetracklist.
Ifrepeatisenabledthenexttrackcanlooparoundthetracklist.
Whenrandomisenabledthisshouldbearandomtrack,alltracksshouldbeplayedoncebeforethetracklistrepeats.
ReturntypeintorNoneNewinversion1.
1.
TracklistController.
get_previous_tlid()ReturnstheTLIDofthetrackthatwillbeplayedifcallingmopidy.
core.
PlaybackController.
previous().
Fornormalplaybackthisistheprevioustrackinthetracklist.
Ifrandomand/orconsumeisenableditshouldreturnthecurrenttrackinstead.
ReturntypeintorNoneNewinversion1.
1.
TracklistController.
eot_track(tl_track)Thetrackthatwillbeplayedafterthegiventrack.
Notnecessarilythesametrackasnext_track().
Deprecatedsinceversion3.
0:Useget_eot_tlid()instead.
Parameterstl_track(mopidy.
models.
TlTrackorNone)–thereferencetrackReturntypemopidy.
models.
TlTrackorNoneTracklistController.
next_track(tl_track)Thetrackthatwillbeplayedifcallingmopidy.
core.
PlaybackController.
next().
162Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfFornormalplaybackthisisthenexttrackinthetracklist.
Ifrepeatisenabledthenexttrackcanlooparoundthetracklist.
Whenrandomisenabledthisshouldbearandomtrack,alltracksshouldbeplayedoncebeforethetracklistrepeats.
Deprecatedsinceversion3.
0:Useget_next_tlid()instead.
Parameterstl_track(mopidy.
models.
TlTrackorNone)–thereferencetrackReturntypemopidy.
models.
TlTrackorNoneTracklistController.
previous_track(tl_track)Returnsthetrackthatwillbeplayedifcallingmopidy.
core.
PlaybackController.
previous().
Fornormalplaybackthisistheprevioustrackinthetracklist.
Ifrandomand/orconsumeisenableditshouldreturnthecurrenttrackinstead.
Deprecatedsinceversion3.
0:Useget_previous_tlid()instead.
Parameterstl_track(mopidy.
models.
TlTrackorNone)–thereferencetrackReturntypemopidy.
models.
TlTrackorNoneOptionsTracklistController.
get_consume()Getconsumemode.
TrueTracksareremovedfromthetracklistwhentheyhavebeenplayed.
FalseTracksarenotremovedfromthetracklist.
TracklistController.
set_consume(value)Setconsumemode.
TrueTracksareremovedfromthetracklistwhentheyhavebeenplayed.
FalseTracksarenotremovedfromthetracklist.
TracklistController.
get_random()Getrandommode.
TrueTracksareselectedatrandomfromthetracklist.
FalseTracksareplayedintheorderofthetracklist.
TracklistController.
set_random(value)Setrandommode.
TrueTracksareselectedatrandomfromthetracklist.
FalseTracksareplayedintheorderofthetracklist.
TracklistController.
get_repeat()Getrepeatmode.
TrueThetracklistisplayedrepeatedly.
FalseThetracklistisplayedonce.
TracklistController.
set_repeat(value)Setrepeatmode.
Torepeatasingletrack,setbothrepeatandsingle.
TrueThetracklistisplayedrepeatedly.
24.
2.
Basics163MopidyDocumentation,Release3.
1.
1-1-gf17acacfFalseThetracklistisplayedonce.
TracklistController.
get_single()Getsinglemode.
TruePlaybackisstoppedaftercurrentsong,unlessinrepeatmode.
FalsePlaybackcontinuesaftercurrentsong.
TracklistController.
set_single(value)Setsinglemode.
TruePlaybackisstoppedaftercurrentsong,unlessinrepeatmode.
FalsePlaybackcontinuesaftercurrentsong.
Playbackcontrollerclassmopidy.
core.
PlaybackController(audio,backends,core)PlaybackcontrolPlaybackController.
play(tl_track=None,tlid=None)Playthegiventrack,orifthegiventl_trackandtlidisNone,playthecurrentlyactivetrack.
Notethatthetrackmustalreadybeinthetracklist.
Deprecatedsinceversion3.
0:Thetl_trackargument.
Usetlidinstead.
Parameterstl_track(mopidy.
models.
TlTrackorNone)–tracktoplaytlid(intorNone)–TLIDofthetracktoplayPlaybackController.
next()Changetothenexttrack.
Thecurrentplaybackstatewillbekept.
Ifitwasplaying,playingwillcontinue.
Ifitwaspaused,itwillstillbepaused,etc.
PlaybackController.
previous()Changetotheprevioustrack.
Thecurrentplaybackstatewillbekept.
Ifitwasplaying,playingwillcontinue.
Ifitwaspaused,itwillstillbepaused,etc.
PlaybackController.
stop()Stopplaying.
PlaybackController.
pause()Pauseplayback.
PlaybackController.
resume()Ifpaused,resumeplayingthecurrenttrack.
PlaybackController.
seek(time_position)Seekstotimepositiongiveninmilliseconds.
Parameterstime_position(int)–timepositioninmillisecondsReturntypeTrueifsuccessful,elseFalse164Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfCurrenttrackPlaybackController.
get_current_tl_track()Getthecurrentlyplayingorselectedtrack.
Returnsamopidy.
models.
TlTrackorNone.
PlaybackController.
get_current_track()Getthecurrentlyplayingorselectedtrack.
Extractedfromget_current_tl_track()forconvenience.
Returnsamopidy.
models.
TrackorNone.
PlaybackController.
get_stream_title()GetthecurrentstreamtitleorNone.
PlaybackController.
get_time_position()Gettimepositioninmilliseconds.
PlaybackstatesPlaybackController.
get_state()GetTheplaybackstate.
PlaybackController.
set_state(new_state)Settheplaybackstate.
MustbePLAYING,PAUSED,orSTOPPED.
Possiblestatesandtransitions:24.
2.
Basics165MopidyDocumentation,Release3.
1.
1-1-gf17acacfclassmopidy.
core.
PlaybackStateSTOPPED='stopped'PLAYING='playing'PAUSED='paused'Librarycontrollerclassmopidy.
core.
LibraryControllerLibraryController.
browse(uri)Browsedirectoriesandtracksatthegivenuri.
uriisastringwhichrepresentssomedirectorybelongingtoabackend.
TogettheintialrootdirectoriesforbackendspassNoneastheURI.
Returnsalistofmopidy.
models.
Refobjectsforthedirectoriesandtracksatthegivenuri.
TheRefobjectsrepresentingtrackskeepthetrack'soriginalURI.
Amatchingpairofobjectscanlooklikethis:Track(uri='dummy:/foo.
mp3',name='foo',artists=.
.
.
,album=.
.
.
)Ref.
track(uri='dummy:/foo.
mp3',name='foo')TheRefobjectsrepresentingdirectorieshavebackendspecicURIs.
Theseareopaquevalues,sonoonebutthebackendthatcreatedthemshouldtryandderiveanymeaningfromthem.
Theonlyvalidexceptiontothisischeckingthescheme,asitisusedtoroutebrowserequeststothecorrectbackend.
Forexample,thedummylibrary's/bardirectorycouldbereturnedlikethis:Ref.
directory(uri='dummy:directory:/bar',name='bar')Parametersuri(string)–URItobrowseReturntypelistofmopidy.
models.
RefNewinversion0.
18.
LibraryController.
search(query,uris=None,exact=False)Searchthelibraryfortrackswherefieldcontainsvalues.
fieldcanbeoneofuri,track_name,album,artist,albumartist,composer,performer,track_no,genre,date,comment,orany.
Ifurisisgiven,thesearchislimitedtoresultsfromwithintheURIroots.
Forexamplepassinguris=['file:']willlimitthesearchtothelocalbackend.
Examples:#Returnsresultsmatching'a'inanybackendsearch({'any':['a']})#Returnsresultsmatchingartist'xyz'inanybackendsearch({'artist':['xyz']})#Returnsresultsmatching'a'and'b'andartist'xyz'inany#backendsearch({'any':['a','b'],'artist':['xyz']})(continuesonnextpage)166Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacf(continuedfrompreviouspage)#Returnsresultsmatching'a'ifwithinthegivenURIroots#"file:///media/music"and"spotify:"search({'any':['a']},uris=['file:///media/music','spotify:'])#Returnsresultsmatchingartist'xyz'and'abc'inanybackendsearch({'artist':['xyz','abc']})Parametersquery(dict)–oneormorequeriestosearchforuris(listofstringorNone)–zeroormoreURIrootstolimitthesearchtoexact(bool)–ifthesearchshoulduseexactmatchingReturntypelistofmopidy.
models.
SearchResultNewinversion1.
0:Theexactkeywordargument.
LibraryController.
lookup(uris)LookupthegivenURIs.
IftheURIexpandstomultipletracks,thereturnedlistwillcontainthemall.
Parametersuris(listofstring)–trackURIsReturntype{uri:listofmopidy.
models.
Track}LibraryController.
refresh(uri=None)Refreshlibrary.
LimittoURIandbelowifanURIisgiven.
Parametersuri(string)–directoryortrackURILibraryController.
get_images(uris)LookuptheimagesforthegivenURIsBackendscanusethistoreturnimageURIsforanyURItheyknowaboutbeittracks,albums,playlists.
ThelookupresultisadictionarymappingtheprovidedURIstolistsofimages.
UnknownURIsorURIsthecorrespondingbackendcouldn'tndanythingforwillsimplyreturnanemptylistforthatURI.
Parametersuris(listofstring)–listofURIstondimagesforReturntype{uri:tupleofmopidy.
models.
Image}Newinversion1.
0.
LibraryController.
get_distinct(eld,query=None)Listdistinctvaluesforagiveneldfromthelibrary.
ThishasmainlybeenaddedtosupportthelistcommandstheMPDprotocolsupportsinamoresanefashion.
Otherfrontendsarenotrecommendedtousethismethod.
Parametersfield(string)–Oneoftrack,artist,albumartist,album,composer,performer,dateorgenre.
query(dict)–Querytouseforlimitingresults,seesearch()fordetailsaboutthequeryformat.
Returntypesetofvaluescorrespondingtotherequestedeldtype.
24.
2.
Basics167MopidyDocumentation,Release3.
1.
1-1-gf17acacfNewinversion1.
0.
Playlistscontrollerclassmopidy.
core.
PlaylistsControllerPlaylistsController.
get_uri_schemes()GetthelistofURIschemesthatsupportplaylists.
ReturntypelistofstringNewinversion2.
0.
FetchingPlaylistsController.
as_list()Getalistofthecurrentlyavailableplaylists.
ReturnsalistofRefobjectsreferringtotheplaylists.
Inotherwords,noinformationabouttheplaylists'contentisgiven.
Returntypelistofmopidy.
models.
RefNewinversion1.
0.
PlaylistsController.
get_items(uri)Gettheitemsinaplaylistspeciedbyuri.
ReturnsalistofRefobjectsreferringtotheplaylist'sitems.
Ifaplaylistwiththegivenuridoesn'texist,itreturnsNone.
Returntypelistofmopidy.
models.
Ref,orNoneNewinversion1.
0.
PlaylistsController.
lookup(uri)LookupplaylistwithgivenURIinboththesetofplaylistsandinanyotherplaylistsources.
ReturnsNoneifnotfound.
Parametersuri(string)–playlistURIReturntypemopidy.
models.
PlaylistorNonePlaylistsController.
refresh(uri_scheme=None)Refreshtheplaylistsinplaylists.
Ifuri_schemeisNone,allbackendsareaskedtorefresh.
Ifuri_schemeisanURIschemehandledbyabackend,onlythatbackendisaskedtorefresh.
Ifuri_schemedoesn'tmatchanycurrentbackend,nothinghappens.
Parametersuri_scheme(string)–limittothebackendmatchingtheURIscheme168Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfManipulatingPlaylistsController.
create(name,uri_scheme=None)Createanewplaylist.
Ifuri_schemematchesanURIschemehandledbyacurrentbackend,thatbackendisaskedtocreatetheplaylist.
Ifuri_schemeisNoneordoesn'tmatchacurrentbackend,therstbackendisaskedtocreatetheplaylist.
Allnewplaylistsmustbecreatedbycallingthismethod,andnotbycreatingnewinstancesofmopidy.
models.
Playlist.
Parametersname(string)–nameofthenewplaylisturi_scheme(string)–usethebackendmatchingtheURIschemeReturntypemopidy.
models.
PlaylistorNonePlaylistsController.
save(playlist)Savetheplaylist.
Foraplaylisttobesaveable,itmusthavetheuriattributeset.
Youmustnotsettheuriatributeyourself,butuseplaylistobjectsreturnedbycreate()orretrievedfromplaylists,whichwillalwaysgiveyousaveableplaylists.
Themethodreturnsthesavedplaylist.
Thereturnplaylistmaydifferfromthesavedplaylist.
E.
g.
iftheplaylistnamewaschanged,thereturnedplaylistmayhaveadifferentURI.
Thecallerofthismethodmustthrowawaytheplaylistsenttothismethod,andusethereturnedplaylistinstead.
Iftheplaylist'sURIisn'tsetordoesn'tmatchtheURIschemeofacurrentbackend,nothingisdoneandNoneisreturned.
Parametersplaylist(mopidy.
models.
Playlist)–theplaylistReturntypemopidy.
models.
PlaylistorNonePlaylistsController.
delete(uri)DeleteplaylistidentiedbytheURI.
IftheURIdoesn'tmatchtheURIschemeshandledbythecurrentbackends,nothinghappens.
ReturnsTrueifdeleted,Falseotherwise.
Parametersuri(string)–URIoftheplaylisttodeleteReturntypeboolChangedinversion2.
2:Returntypedened.
Mixercontrollerclassmopidy.
core.
MixerControllerMixerController.
get_mute()Getmutestate.
Trueifmuted,Falseunmuted,Noneifunknown.
MixerController.
set_mute(mute)Setmutestate.
Truetomute,Falsetounmute.
24.
2.
Basics169MopidyDocumentation,Release3.
1.
1-1-gf17acacfReturnsTrueifcallissuccessful,otherwiseFalse.
MixerController.
get_volume()Getthevolume.
Integerinrange[0.
.
100]orNoneifunknown.
Thevolumescaleislinear.
MixerController.
set_volume(volume)Setthevolume.
Thevolumeisdenedasanintegerinrange[0.
.
100].
Thevolumescaleislinear.
ReturnsTrueifcallissuccessful,otherwiseFalse.
Historycontrollerclassmopidy.
core.
HistoryControllerHistoryController.
get_history()Getthetrackhistory.
Thetimestampsaremillisecondssinceepoch.
ReturnsthetrackhistoryReturntypelistof(timestamp,mopidy.
models.
Ref)tuplesHistoryController.
get_length()Getthenumberoftracksinthehistory.
ReturnsthehistorylengthReturntypeintCoreeventsclassmopidy.
core.
CoreListenerMarkerinterfaceforrecipientsofeventssentbythecoreactor.
AnyPykkaactorthatmixesinthisclasswillreceivecallstothemethodsdenedherewhenthecorrespondingeventshappeninthecoreactor.
Thisinterfaceisusedbothforlookingupwhatactorstonotifyoftheevents,andforprovidingdefaultimplementationsforthoselistenersthatarenotinterestedinallevents.
mute_changed(mute)Calledwheneverthemutestateischanged.
MAYbeimplementedbyactor.
Parametersmute(boolean)–thenewmutestateon_event(event,**kwargs)Calledonallevents.
MAYbeimplementedbyactor.
Bydefault,thismethodforwardstheeventtothespeciceventmethods.
Parametersevent(string)–theeventnamekwargs–anyotherargumentstothespeciceventhandlers170Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfoptions_changed()Calledwheneveranoptionischanged.
MAYbeimplementedbyactor.
playback_state_changed(old_state,new_state)Calledwheneverplaybackstateischanged.
MAYbeimplementedbyactor.
Parametersold_state(stringfrommopidy.
core.
PlaybackStateeld)–thestatebeforethechangenew_state(stringfrommopidy.
core.
PlaybackStateeld)–thestateafterthechangeplaylist_changed(playlist)Calledwheneveraplaylistischanged.
MAYbeimplementedbyactor.
Parametersplaylist(mopidy.
models.
Playlist)–thechangedplaylistplaylist_deleted(uri)Calledwheneveraplaylistisdeleted.
MAYbeimplementedbyactor.
Parametersuri(string)–theURIofthedeletedplaylistplaylists_loaded()Calledwhenplaylistsareloadedorrefreshed.
MAYbeimplementedbyactor.
seeked(time_position)Calledwheneverthetimepositionchangesbyanunexpectedamount,e.
g.
atseektoanewtimeposition.
MAYbeimplementedbyactor.
Parameterstime_position(int)–thepositionthatwasseekedtoinmillisecondsstaticsend(event,**kwargs)Helpertoallowcallingofcorelistenereventsstream_title_changed(title)Calledwheneverthecurrentlyplayingstreamtitlechanges.
MAYbeimplementedbyactor.
Parameterstitle(string)–thenewstreamtitletrack_playback_ended(tl_track,time_position)Calledwheneverplaybackofatrackends.
MAYbeimplementedbyactor.
Parameterstl_track(mopidy.
models.
TlTrack)–thetrackthatwasplayedbeforeplaybackstoppedtime_position(int)–thetimepositioninmilliseconds24.
2.
Basics171MopidyDocumentation,Release3.
1.
1-1-gf17acacftrack_playback_paused(tl_track,time_position)Calledwhenevertrackplaybackispaused.
MAYbeimplementedbyactor.
Parameterstl_track(mopidy.
models.
TlTrack)–thetrackthatwasplayingwhenplaybackpausedtime_position(int)–thetimepositioninmillisecondstrack_playback_resumed(tl_track,time_position)Calledwhenevertrackplaybackisresumed.
MAYbeimplementedbyactor.
Parameterstl_track(mopidy.
models.
TlTrack)–thetrackthatwasplayingwhenplaybackresumedtime_position(int)–thetimepositioninmillisecondstrack_playback_started(tl_track)Calledwheneveranewtrackstartsplaying.
MAYbeimplementedbyactor.
Parameterstl_track(mopidy.
models.
TlTrack)–thetrackthatjuststartedplayingtracklist_changed()Calledwheneverthetracklistischanged.
MAYbeimplementedbyactor.
volume_changed(volume)Calledwheneverthevolumeischanged.
MAYbeimplementedbyactor.
Parametersvolume(int)–thenewvolumeintherange[0.
.
100]24.
2.
2FrontendAPIThefollowingrequirementsappliestoanyfrontendimplementation:AfrontendMAYdomostlywhateveritwantsto,includingcreatingthreads,openingTCPportsandexposingMopidyforagroupofclients.
AfrontendMUSTimplementatleastonePykkaactor,calledthe"mainactor"fromhereon.
ThemainactorMUSTaccepttwoconstructorarguments:–config,whichisadictstructurewiththeentireMopidyconguration.
–core,whichwillbeanActorProxyforthecoreactor.
Thisobjectgivesaccesstothefullmopidy.
core—CoreAPI.
ItMAYuseadditionalactorstoimplementwhateveritdoes,andusingactorsinfrontendimplementationsisencouraged.
Thefrontendisenablediftheextensionitispartofisenabled.
SeeExtensiondevelopmentformoreinformation.
ThemainactorMUSTbeabletostartandstopthefrontendwhenthemainactorisstartedandstopped.
172Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfThefrontendMAYrequireadditionalcongvaluestobesetforittowork.
SuchcongvaluesMUSTbedocumented.
ThemainactorMUSTraisethemopidy.
exceptions.
FrontendErrorwithadescriptiveerrormessageifthedenedcongvaluesarenotadequateforthefrontendtoworkproperly.
AnyactorwhichispartofthefrontendMAYimplementthemopidy.
core.
CoreListenerinterfacetoreceivenoticationofthespeciedevents.
FrontendimplementationsSeetheextensionregistry.
24.
2.
3mopidy.
backend—BackendAPIThebackendAPIistheinterfacethatmustbeimplementedwhenyoucreateabackend.
Ifyouareworkingonafrontendandneedtoaccessthebackends,seethemopidy.
core—CoreAPIinstead.
URIsandroutingofrequeststothebackendWhenMopidy'scorelayerisprocessingaclientrequest,itroutestherequesttooneormoreappropriateback-endsbasedontheURIsoftheobjectstherequesttoucheson.
Theobjects'URIsarecomparedwiththebackends'uri_schemestoselecttherelevantbackends.
AnoftenusedpatternwhenimplementingMopidybackendsistocreateyourownURIschemewhichyouuseforalltracks,playlists,etc.
relatedtoyourbackend.
InmostcasestheMopidyURIistranslatedtoanactualURIthatGStreamerknowshowtoplayrightbeforeplayback.
Forexample:SpotifyalreadyhasitsownURIscheme(spotify:track:.
.
.
,spotify:playlist:.
.
.
,etc.
)usedthroughouttheirapplications,andthusMopidy-SpotifysimplyusesthesameURIscheme.
PlaybackishandledbypushingrawaudiodataintoaGStreamerappsrcelement.
Mopidy-SoundCloudcreatedit'sownURIscheme,afterthemodelofSpotify,anduseURIsofthefollowingforms:soundcloud:search,soundcloud:user-.
.
.
,soundcloud:exp-.
.
.
,andsoundcloud:set-.
.
.
.
Playbackishandledbyconvertingthecustomsoundcloud:.
.
URIstohttp://URIsimmediatelybeforetheyarepassedontoGStreamerforplayback.
Mopidydifferentiatesbetweenfile://.
.
.
URIshandledbyMopidy-Streamandlocal:.
.
.
URIshan-dledbyMopidy-Local.
Mopidy-Streamcanplayfile://.
.
.
URIspointingtotracksandplaylistslocatedanywhereonyoursystem,butitdoesn'tknowathingabouttheobjectbeforeyouplayit.
Ontheotherhand,Mopidy-Localscansapredenedlocal/media_dirtobuildametadatalibraryofallknowntracks.
Itisthuslimitedtoplayingtracksresidinginthemedialibrary,butcanprovideadditionalfeatureslikedirectorybrowsingandsearch.
Inotherwords,wehavetwodifferentwaysofplayinglocalmusic,handledbytwodif-ferentbackends,andhavethuscreatedtwodifferentURIschemestoseparatetheirhandling.
Thelocal:.
.
.
URIsareconvertedtofile://.
.
.
URIsimmediatelybeforetheyarepassedontoGStreamerforplayback.
Ifthereisn'tanexistingURIschemethattsforyourbackend'spurpose,youshouldcreateyourown,andnameitafteryourextension'sext_name.
CareshouldbetakennottoconictwithalreadyinuseURIschemes.
Itisalsorecommendedtodesigntheformatsuchthattracks,playlistsandotherentitiescanbedistinguishedeasily.
24.
2.
Basics173MopidyDocumentation,Release3.
1.
1-1-gf17acacfBackendclassclassmopidy.
backend.
BackendBackendAPIIfthebackendhasproblemsduringinitializationitshouldraisemopidy.
exceptions.
BackendErrorwithadescriptiveerrormessage.
ThiswillmakeMopidyprinttheerrormessageandexitsothattheusercanxtheissue.
Parametersconfig(dict)–theentireMopidycongurationaudio(pykka.
ActorProxyformopidy.
audio.
Audio)–actorproxyfortheaudiosubsystemaudio=NoneActorproxytoaninstanceofmopidy.
audio.
Audio.
Shouldbepassedtothebackendconstructorasthekwargaudio,whichwillthensetthiseld.
library=NoneThelibraryprovider.
AninstanceofLibraryProvider,orNoneifthebackenddoesn'tprovidealibrary.
ping()Calledtocheckiftheactorisstillalive.
playback=NoneTheplaybackprovider.
AninstanceofPlaybackProvider,orNoneifthebackenddoesn'tprovideplayback.
playlists=NoneTheplaylistsprovider.
AninstanceofPlaylistsProvider,orclass:Noneifthebackenddoesn'tprovideplaylists.
uri_schemes=[]ListofURIschemesthisbackendcanhandle.
Playbackproviderclassmopidy.
backend.
PlaybackProvider(audio,backend)Parametersaudio(actorproxytoaninstanceofmopidy.
audio.
Audio)–theaudioactorbackend(mopidy.
backend.
Backend)–thebackendchange_track(track)Switchtoprovidedtrack.
MAYbereimplementedbysubclass.
Itisunlikelyitmakessenseforanybackendstooverridethis.
Formostpracticalpurposesitshouldbeconsideredaninternalcallbetweenbackendsandcorethatbackendauthorsshouldnottouch.
Thedefaultimplementationwillcalltranslate_uri()whichiswhatyouwanttoimplement.
Parameterstrack(mopidy.
models.
Track)–thetracktoplayReturntypeTrueifsuccessful,elseFalse174Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfget_time_position()Getthecurrenttimepositioninmilliseconds.
MAYbereimplementedbysubclass.
Returntypeintis_live(uri)DecideiftheURIshouldbetreatedasalivestreamornot.
MAYbereimplementedbysubclass.
Playingasourceasalivestreamdisablesbuffering,whichreduceslatencybeforeplaybackstarts,anddiscardsdatawhenpaused.
Parametersuri(string)–theURIReturntypeboolpause()Pauseplayback.
MAYbereimplementedbysubclass.
ReturntypeTrueifsuccessful,elseFalseplay()Startplayback.
MAYbereimplementedbysubclass.
ReturntypeTrueifsuccessful,elseFalseprepare_change()IndicatethatanURIchangeisabouttohappen.
MAYbereimplementedbysubclass.
Itisextremelyunlikelyitmakessenseforanybackendstooverridethis.
Formostpracticalpurposesitshouldbeconsideredaninternalcallbetweenbackendsandcorethatbackendauthorsshouldnottouch.
resume()Resumeplaybackatthesametimepositionplaybackwaspaused.
MAYbereimplementedbysubclass.
ReturntypeTrueifsuccessful,elseFalseseek(time_position)Seektoagiventimeposition.
MAYbereimplementedbysubclass.
Parameterstime_position(int)–timepositioninmillisecondsReturntypeTrueifsuccessful,elseFalseshould_download(uri)AttemptprogressivedownloadbufferingfortheURIornot.
MAYbereimplementedbysubclass.
Whenstreamingaxedlengthle,theentirelecanbebufferedtoimproveplaybackperformance.
Parametersuri(string)–theURIReturntypebool24.
2.
Basics175MopidyDocumentation,Release3.
1.
1-1-gf17acacfstop()Stopplayback.
MAYbereimplementedbysubclass.
Shouldnotbeusedfortrackingiftrackshavebeenplayedorwhenwearedoneplayingthem.
ReturntypeTrueifsuccessful,elseFalsetranslate_uri(uri)ConvertcustomURIschemetorealplayableURI.
MAYbereimplementedbysubclass.
Thisisverylikelytheonlythingyouneedtooverrideasabackendauthor.
TypicallythisiswhereyouconvertanyMopidyspecicURItoarealURIandthenreturnit.
Ifyoucan'tconverttheURIjustreturnNone.
Parametersuri(string)–theURItotranslateReturntypestringorNoneiftheURIcouldnotbetranslatedPlaylistsproviderclassmopidy.
backend.
PlaylistsProvider(backend)Aplaylistproviderexposesacollectionofplaylists,methodstocreate/change/deleteplaylistsinthiscollection,andlookupofanyplaylistthebackendknowsabout.
Parametersbackend(mopidy.
backend.
Backendinstance)–backendthecontrollerisapartofas_list()Getalistofthecurrentlyavailableplaylists.
ReturnsalistofRefobjectsreferringtotheplaylists.
Inotherwords,noinformationabouttheplaylists'contentisgiven.
Returntypelistofmopidy.
models.
RefNewinversion1.
0.
create(name)Createanewemptyplaylistwiththegivenname.
ReturnsanewplaylistwiththegivennameandanURI,orNoneonfailure.
MUSTbeimplementedbysubclass.
Parametersname(string)–nameofthenewplaylistReturntypemopidy.
models.
PlaylistorNonedelete(uri)DeleteplaylistidentiedbytheURI.
ReturnsTrueifdeleted,Falseotherwise.
MUSTbeimplementedbysubclass.
Parametersuri(string)–URIoftheplaylisttodeleteReturntypeboolChangedinversion2.
2:Returntypedened.
176Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfget_items(uri)Gettheitemsinaplaylistspeciedbyuri.
ReturnsalistofRefobjectsreferringtotheplaylist'sitems.
Ifaplaylistwiththegivenuridoesn'texist,itreturnsNone.
Returntypelistofmopidy.
models.
Ref,orNoneNewinversion1.
0.
lookup(uri)LookupplaylistwithgivenURIinboththesetofplaylistsandinanyotherplaylistsource.
ReturnstheplaylistsorNoneifnotfound.
MUSTbeimplementedbysubclass.
Parametersuri(string)–playlistURIReturntypemopidy.
models.
PlaylistorNonerefresh()Refreshtheplaylistsinplaylists.
MUSTbeimplementedbysubclass.
save(playlist)Savethegivenplaylist.
Theplaylistmusthaveanuriattributeset.
TocreateanewplaylistwithanURI,usecreate().
ReturnsthesavedplaylistorNoneonfailure.
MUSTbeimplementedbysubclass.
Parametersplaylist(mopidy.
models.
Playlist)–theplaylisttosaveReturntypemopidy.
models.
PlaylistorNoneLibraryproviderclassmopidy.
backend.
LibraryProvider(backend)Parametersbackend(mopidy.
backend.
Backend)–backendthecontrollerisapartofbrowse(uri)Seemopidy.
core.
LibraryController.
browse().
Ifyouimplementthismethod,makesuretoalsosetroot_directory.
MAYbeimplementedbysubclass.
get_distinct(eld,query=None)Seemopidy.
core.
LibraryController.
get_distinct().
MAYbeimplementedbysubclass.
Defaultimplementationwillsimplyreturnanemptyset.
Notethatbackendsshouldalwaysreturnanemptysetforunexpectedeldtypes.
get_images(uris)Seemopidy.
core.
LibraryController.
get_images().
MAYbeimplementedbysubclass.
24.
2.
Basics177MopidyDocumentation,Release3.
1.
1-1-gf17acacfDefaultimplementationwillsimplyreturnanemptydictionary.
lookup(uri)Seemopidy.
core.
LibraryController.
lookup().
MUSTbeimplementedbysubclass.
refresh(uri=None)Seemopidy.
core.
LibraryController.
refresh().
MAYbeimplementedbysubclass.
root_directory=Nonemopidy.
models.
Ref.
directoryinstancewithaURIandnamesetrepresentingtherootofthislibrary'sbrowsetree.
URIsmustuseoneoftheschemessupportedbythebackend,andnameshouldbesettoahumanfriendlyvalue.
MUSTbesetbyanyclassthatimplementsLibraryProvider.
browse().
search(query=None,uris=None,exact=False)Seemopidy.
core.
LibraryController.
search().
MAYbeimplementedbysubclass.
Newinversion1.
0:Theexactparamwhichreplacestheoldfind_exact.
Backendlistenerclassmopidy.
backend.
BackendListenerMarkerinterfaceforrecipientsofeventssentbythebackendactors.
AnyPykkaactorthatmixesinthisclasswillreceivecallstothemethodsdenedherewhenthecorrespondingeventshappeninabackendactor.
Thisinterfaceisusedbothforlookingupwhatactorstonotifyoftheevents,andforprovidingdefaultimplementationsforthoselistenersthatarenotinterestedinallevents.
Normally,onlytheCoreactorshouldmixinthisclass.
playlists_loaded()Calledwhenplaylistsareloadedorrefreshed.
MAYbeimplementedbyactor.
staticsend(event,**kwargs)HelpertoallowcallingofbackendlistenereventsBackendimplementationsSeetheextensionregistry.
178Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacf24.
2.
4mopidy.
ext–ExtensionAPIIfyouwanttolearnhowtomakeMopidyextensions,readExtensiondevelopment.
classmopidy.
ext.
ExtensionBaseclassforMopidyextensionsdist_name=NoneTheextension'sdistributionname,asregisteredonPyPIExample:Mopidy-Soundspotext_name=NoneTheextension'sshortname,asusedinsetup.
pyandascongsectionnameExample:soundspotclassmethodget_cache_dir(cong)Getorcreatecachedirectoryfortheextension.
Usethisdirectorytocachedatathatcansafelybethrownaway.
Parametersconfig–theMopidycongobjectReturnspathlib.
Pathget_command()Commandtoexposetocommandlineusersrunningmopidy.
ReturnsInstanceofaCommandclass.
classmethodget_config_dir(cong)Getorcreatecongurationdirectoryfortheextension.
Parametersconfig–theMopidycongobjectReturnspathlib.
Pathget_config_schema()Theextension'scongvalidationschemaReturnsConfigSchemaclassmethodget_data_dir(cong)Getorcreatedatadirectoryfortheextension.
Usethisdirectorytostoredatathatshouldbepersistent.
Parametersconfig–theMopidycongobjectReturnspathlib.
Pathget_default_config()Theextension'sdefaultcongasabytestringReturnsbytesorunicodesetup(registry)Registertheextension'scomponentsintheextensionRegistry.
Forexample,toregisterabackend:defsetup(self,registry):from.
backendimportSoundspotBackendregistry.
add('backend',SoundspotBackend)24.
2.
Basics179MopidyDocumentation,Release3.
1.
1-1-gf17acacfSeeRegistryforalistofregistrykeyswithaspecialmeaning.
Mopidywillinstantiateandstartanyclassesregisteredunderthefrontendandbackendregistrykeys.
Thismethodcanalsobeusedforothersetuptasksnotinvolvingtheextensionregistry.
Parametersregistry(Registry)–theextensionregistryvalidate_environment()Checksiftheextensioncanruninthecurrentenvironment.
Dependenciesdescribedbysetup.
pyarecheckedbyMopidy,soyoushouldnotchecktheirpresencehere.
Ifaproblemisfound,raiseExtensionErrorwithamessageexplainingtheissue.
RaisesExtensionErrorReturnsNoneversion=NoneTheextension'sversionShouldmatchthe__version__attributeontheextension'smainPythonmoduleandtheversionregis-teredonPyPI.
classmopidy.
ext.
ExtensionData(extension,entry_point,cong_schema,cong_defaults,com-mand)propertycommandAliasforeldnumber4propertyconfig_defaultsAliasforeldnumber3propertyconfig_schemaAliasforeldnumber2propertyentry_pointAliasforeldnumber1propertyextensionAliasforeldnumber0classmopidy.
ext.
RegistryRegistryofcomponentsprovidedbyMopidyextensions.
Passedtothesetup()methodofallextensions.
Theregistrycanbeusedlikeadictofstringkeysandlists.
Somekeyshaveaspecialmeaning,including,butnotlimitedto:backendisusedforMopidybackendclasses.
frontendisusedforMopidyfrontendclasses.
Extensionscanusetheregistryforallowothertoextendtheextensionitself.
ForexampletheMopidy-Localhistoricallyusedthelocal:librarykeytoallowotherextensionstoregisterlibraryprovidersforMopidy-Localtouse.
Extensionsshouldnamespacecustomkeyswiththeextension'sext_name,e.
g.
local:fooorhttp:bar.
add(name,cls)Addacomponenttotheregistry.
Multipleclassescanberegisteredtothesamename.
mopidy.
ext.
load_extensions()Findallinstalledextensions.
180Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfReturnslistofinstalledextensionsmopidy.
ext.
validate_extension_data(data)Verifyextension'sdependenciesandenvironment.
Parametersextensions–anextensiontocheckReturnsifextensionshouldberun24.
3Web/JavaScript24.
3.
1HTTPserversideAPITheMopidy-HTTPextensioncomeswithanHTTPservertohostMopidy'sHTTPJSON-RPCAPI.
ThiswebservercanalsobeusedbyotherextensionsthatneedtoexposesomethingoverHTTP.
TheHTTPserversideAPIcanbeusedto:hoststaticlesfore.
g.
aMopidyclientwritteninpureJavaScript,hostaTornadoapplication,orhostaWSGIapplication,includinge.
g.
Flaskapplications.
Tohoststaticlesusingthewebserver,anextensionneedstoregisteranameandalepathintheextensionregistryunderthehttp:statickey.
Toextendthewebserverwithawebapplication,anextensionmustregisteranameandafactoryfunctionintheextensionregistryunderthehttp:appkey.
FordetailsonhowtomakeaMopidyextension,seetheExtensiondevelopmentguide.
StaticwebclientexampleToservestaticles,youjustneedtoregisteranhttp:staticdictionaryintheextensionregistry.
Thedictionarymusthavetwokeys:nameandpath.
ThenameisusedtobuildtheURLthestaticleswillbeservedon.
Byconvention,itshouldbeidenticalwiththeextension'sext_name,likeinthefollowingexample.
ThepathtellsMopidywhereonthediskthestaticlesarelocated.
Assumingthatthecodebelowislocatedinthelemywebclient/__init__.
py,thelesinthedirectorymywebclient/static/willbemadeavailableat/mywebclient/onMopidy'swebserver.
Forexample,mywebclient/static/foo.
htmlwillbeavailableathttp://localhost:6680/mywebclient/foo.
html.
importosfrommopidyimportextclassMyWebClientExtension(ext.
Extension):ext_name='mywebclient'defsetup(self,registry):registry.
add('http:static',{'name':self.
ext_name,'path':os.
path.
join(os.
path.
dirname(__file__),'static'),})#SeetheExtensionAPIforthefulldetailsonthisclass24.
3.
Web/JavaScript181MopidyDocumentation,Release3.
1.
1-1-gf17acacfTornadoapplicationexampleTheMopidy-HTTPextension'swebserverisbasedontheTornadowebframework.
Thus,ithasrstclasssupportforTornadorequesthandlers.
Inthefollowingexample,wecreateatornado.
web.
RequestHandlercalledMyRequestHandlerthatre-spondstoHTTPGETrequestswiththestringHello,world!
ThisisMopidy$version,whereitgetstheMopidyversionfromMopidy'scoreAPI.
TohooktherequesthandlerintoMopidy'swebserver,wemustregisteradictionaryunderthehttp:appkeyintheextensionregistry.
Thedictionarymusthavetwokeys:nameandfactory.
ThenameisusedtobuildtheURLtheappwillbeservedon.
Byconvention,itshouldbeidenticalwiththeextension'sext_name,likeinthefollowingexample.
Thefactorymustbeafunctionthatacceptstwoarguments,configandcore,respectivelyadictstructureofMopidy'scongandapykka.
ActorProxytothefullMopidycoreAPI.
ThefactoryfunctionmustreturnalistofTornadorequesthandlers.
TheURLpatternsoftherequesthandlersshouldnotincludethename,asthatwillbeprependedtotheURLpatternsbythewebserver.
Whentheextensionisinstalled,Mopidywillrespondtorequeststohttp://localhost:6680/mywebclient/withthestringHello,world!
ThisisMopidy$version.
importosimporttornado.
webfrommopidyimportextclassMyRequestHandler(tornado.
web.
RequestHandler):definitialize(self,core):self.
core=coredefget(self):self.
write('Hello,world!
ThisisMopidy%s'%self.
core.
get_version().
get())defmy_app_factory(config,core):return[('/',MyRequestHandler,{'core':core})]classMyWebClientExtension(ext.
Extension):ext_name='mywebclient'defsetup(self,registry):registry.
add('http:app',{'name':self.
ext_name,'factory':my_app_factory,})#SeetheExtensionAPIforthefulldetailsonthisclass182Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfWSGIapplicationexampleWSGIapplicationsaresecond-classcitizensonMopidy'sHTTPserver.
TheWSGIapplicationsareruninsideTor-nado,whichisbasedonnon-blockingI/Oandasingleeventloop.
Inotherwords,yourWSGIapplicationswillonlyhaveasinglethreadtorunon,andifyourapplicationisdoingblockingI/O,itwillblockallotherrequestsfrombeinghandledbythewebserveraswell.
TheexamplebelowshowshowaWSGIapplicationthatreturnsthestringHello,world!
ThisisMopidy$versiononallrequests.
TheWSGIapplicationiswrappedasaTornadoapplicationandmountedathttp://localhost:6680/mywebclient/.
importosimporttornado.
webimporttornado.
wsgifrommopidyimportextdefmy_app_factory(config,core):defwsgi_app(environ,start_response):status='200OK'response_headers=[('Content-type','text/plain')]start_response(status,response_headers)return['Hello,world!
ThisisMopidy%s\n'%self.
core.
get_version().
get()]return[tornado.
web.
FallbackHandler,{'fallback':tornado.
wsgi.
WSGIContainer(wsgi_app),}),]classMyWebClientExtension(ext.
Extension):ext_name='mywebclient'defsetup(self,registry):registry.
add('http:app',{'name':self.
ext_name,'factory':my_app_factory,})#SeetheExtensionAPIforthefulldetailsonthisclass24.
3.
Web/JavaScript183MopidyDocumentation,Release3.
1.
1-1-gf17acacfAPIimplementorsSeetheextensionregistry.
24.
3.
2HTTPJSON-RPCAPITheMopidy-HTTPextensionmakesMopidy'smopidy.
core—CoreAPIavailableusingJSON-RPCoverHTTPusingHTTPPOSTandWebSockets.
WealsoprovideaJavaScriptwrapper,calledMopidy.
js,aroundtheJSON-RPCoverWebSocketAPIforusebothfrombrowsersandNode.
js.
TheMopidy-API-ExplorerextensioncanalsobeusedtogetyoufamiliarizedwithHTTPbasedAPIs.
HTTPPOSTAPITheMopidywebserveracceptsHTTPrequestswiththePOSTmethodtohttp://localhost:6680/mopidy/rpc,wherethelocalhost:6680partwillvarywithyourlocalsetup.
YourrequestsmustalsosettheContent-Typeheadertoapplication/json.
TheHTTPPOSTendpointgivesyouaccesstoMopidy'sfullcoreAPI,butdoesnotgiveyounoticationonevents.
Ifyouneedtolistentoevents,youshouldprobablyusetheWebSocketAPIinstead.
Exampleusagefromthecommandline:$curl-d'{"jsonrpc":"2.
0","id":1,"method":"core.
playback.
get_state"}'-H→'Content-Type:application/json'http://localhost:6680/mopidy/rpc{"jsonrpc":"2.
0","id":1,"result":"stopped"}Fordetailsontherequestandresponseformat,seeJSON-RPC2.
0messages.
WebSocketAPITheMopidywebserverexposesaWebSocketathttp://localhost:6680/mopidy/ws,wherethelocalhost:6680partwillvarywithyourlocalsetup.
TheWebSocketgivesyouaccesstoMopidy'sfullAPIandenablesMopidytoinstantlypusheventstotheclient,astheyhappen.
OntheWebSocketwesendtwodifferentkindofmessages:TheclientcansendJSON-RPC2.
0requests,andtheserverwillrespondwithJSON-RPC2.
0responses.
Inaddition,theserverwillsendeventmessageswhensomethinghappensontheserver.
BothmessagetypesareencodedasJSONobjects.
Ifyou'reusingtheAPIfromJavaScript,eitherinthebrowserorinNode.
js,youshoulduseMopidy.
jsJavaScriptlibrarywhichwrapstheWebSocketAPIinaniceJavaScriptAPI.
JSON-RPC2.
0messagesJSON-RPC2.
0messagescanberecognizedbycheckingforthekeynamedjsonrpcwiththestringvalue2.
0.
Fordetailsonthemessagingformat,pleaserefertotheJSON-RPC2.
0spec.
Allmethodsinthemopidy.
core—CoreAPIismadeavailablethroughJSON-RPCcallsovertheWebSocket.
Forexample,mopidy.
core.
PlaybackController.
play()isavailableastheJSON-RPCmethodcore.
playback.
play.
ExampleJSON-RPCrequest:{"jsonrpc":"2.
0","id":1,"method":"core.
playback.
get_current_track"}ExampleJSON-RPCresponse:184Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacf{"jsonrpc":"2.
0","id":1,"result":{"__model__":"Track"TheJSON-RPCmethodcore.
describereturnsadatastructuredescribingallavailablemethods.
Ifyou'reunsurehowthecoreAPImapstoJSON-RPC,havingalookatthecore.
describeresponsecanbehelpful.
EventmessagesEventobjectswillalwayshaveakeynamedeventwhosevalueistheeventtype.
Dependingontheeventtype,theeventmayincludeadditionaleldsforrelateddata.
Theeventsmapsdirectlytothemopidy.
core.
CoreListenerAPI.
RefertotheCoreListenermethodnamesistheavailableeventtypes.
TheCoreListenermethod'skeywordargumentsareallincludedasextraeldsontheeventobjects.
Exampleeventmessage:{"event":"track_playback_started","track"24.
3.
3Mopidy.
jsJavaScriptlibraryWe'vemadeaJavaScriptlibrary,Mopidy.
js,whichwrapstheWebSocketAPIandgetsyouquicklystartedwithworkingonyourclientinsteadofguringouthowtocommunicatewithMopidy.
ThislibraryisusedasthefoundationofmostMopidywebclients.
SeetheMopidy.
jsprojectfordetailedusagedocumentationanddemoapplicationsbuiltusingMopidy.
js.
24.
4Audio24.
4.
1mopidy.
audio—AudioAPITheaudioAPIistheinterfacewehavebuiltaroundGStreamertosupportourspecicusecases.
MostbackendsshouldbeabletogetbywithsimplysettingtheURIoftheresourcetheywanttoplay,forthesecasesthedefaultplaybackprovidershouldbeused.
FormoreadvancedcasessuchaswhentherawaudiodataisdeliveredoutsideofGStreamerorthebackendneedstoaddmetadatatothecurrentlyplayingresource,developersshouldsub-classthebaseplaybackproviderandimplementtheextrabehaviourthatisneededthroughthefollowingAPI:classmopidy.
audio.
Audio(cong,mixer)AudiooutputthroughGStreamer.
emit_data(buffer_)Callthistodeliverrawaudiodatatobeplayed.
IfthebufferisNone,theend-of-streamtokenisputontheplaybin.
WewillgetaGStreamermessagewhenthestreamplaybackreachesthetoken,andcanthendoanyend-of-streamrelatedtasks.
NotethattheURImustbesettoappsrc://forthistowork.
ReturnsTrueifdatawasdelivered.
Parametersbuffer(Gst.
BufferorNone)–buffertopasstoappsrcReturntypeboolean24.
4.
Audio185MopidyDocumentation,Release3.
1.
1-1-gf17acacfenable_sync_handler()Enablemanualprocessingofmessagesfrombus.
Shouldonlybeusedbytests.
get_current_tags()Getthecurrentlyplayingmedia'stags.
Ifnotagshavebeenfound,ornothingisplayingthisreturnsanemptydictionary.
Foreachsetoftagswecollectatags_changedeventisemittedwiththekeysofthechangestags.
Aftersuchcallsusersmaycallthisfunctiontogettheupdatedvalues.
Returntype{key:[values]}dictforthecurrentmedia.
get_position()Getpositioninmilliseconds.
Returntypeintmixer=NoneThesoftwaremixinginterfacemopidy.
audio.
actor.
SoftwareMixeron_start()Hookfordoinganysetupthatshouldbedoneaftertheactorisstarted,butbeforeitstartsprocessingmessages.
ForThreadingActor,thismethodisexecutedintheactor'sownthread,while__init__()isexe-cutedinthethreadthatcreatedtheactor.
Ifanexceptionisraisedbythismethodthestacktracewillbelogged,andtheactorwillstop.
on_stop()Hookfordoinganycleanupthatshouldbedoneaftertheactorhasprocessedthelastmessage,andbeforetheactorstops.
Thishookisnotcalledwhentheactorstopsbecauseofanunhandledexception.
Inthatcase,theon_failure()hookiscalledinstead.
ForThreadingActorthismethodisexecutedintheactor'sownthread,immediatelybeforethethreadexits.
Ifanexceptionisraisedbythismethodthestacktracewillbelogged,andtheactorwillstop.
pause_playback()NotifyGStreamerthatitshouldpauseplayback.
ReturntypeTrueifsuccessfull,elseFalseprepare_change()NotifyGStreamerthatweareabouttochangestateofplayback.
ThisfunctionMUSTbecalledbeforechangingURIsordoingchangeslikeupdatingdatathatisbeingpushed.
ThereasonforthisisthatGStreamerwillresetallitsstatewhenitchangestoGst.
State.
READY.
set_about_to_finish_callback(callback)Congureaudiotouseanabout-to-nishcallback.
Thisshouldbeusedtoachievegaplessplayback.
ForthistoworkthecallbackMUSTcallset_uri()withthenewURItoplayandblockuntilthiscallhasbeenmade.
prepare_change()isnotneededbeforeset_uri()inthisonespecialcase.
Parameterscallback(callable)–CallbacktorunwhenweneedthenextURI.
186Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfset_appsrc(caps,need_data=None,enough_data=None,seek_data=None)Switchtousingappsrcforgettingaudiotobeplayed.
YouMUSTcallprepare_change()beforecallingthismethod.
Parameterscaps(string)–GStreamercapsstringdescribingtheaudioformattoexpectneed_data(callablewhichtakesdatalengthhintinms)–call-backforwhenappsrcneedsdataenough_data(callable)–callbackforwhenappsrchasenoughdataseek_data(callablewhichtakestimepositioninms)–callbackforwhendatafromanewpositionisneededtocontinueplaybackset_metadata(track)Settrackmetadataforcurrentlyplayingsong.
Onlyneedstobecalledbysourcessuchasappsrcwhichdonotalreadyinjecttagsinplaybin,e.
g.
whenusingemit_data()todeliverrawaudiodatatoGStreamer.
Parameterstrack(mopidy.
models.
Track)–thecurrenttrackset_position(position)Setpositioninmilliseconds.
Parametersposition(int)–thepositioninmillisecondsReturntypeTrueifsuccessful,elseFalseset_uri(uri,live_stream=False,download=False)SetURIofaudiotobeplayed.
YouMUSTcallprepare_change()beforecallingthismethod.
Parametersuri(string)–theURItoplaylive_stream(bool)–disablesbuffering,reducinglatencyforstream,anddiscardingdatawhenpauseddownload(bool)–enables"download"bufferingmodestart_playback()NotifyGStreamerthatitshouldstartplayback.
ReturntypeTrueifsuccessfull,elseFalsestate='stopped'TheGStreamerstatemappedtomopidy.
audio.
PlaybackStatestop_playback()NotifyGStreamerthatisshouldstopplayback.
ReturntypeTrueifsuccessfull,elseFalsewait_for_state_change()Blockuntilanypendingstatechangesarecomplete.
Shouldonlybeusedbytests.
24.
4.
Audio187MopidyDocumentation,Release3.
1.
1-1-gf17acacfAudiolistenerclassmopidy.
audio.
AudioListenerMarkerinterfaceforrecipientsofeventssentbytheaudioactor.
AnyPykkaactorthatmixesinthisclasswillreceivecallstothemethodsdenedherewhenthecorrespondingeventshappeninthecoreactor.
Thisinterfaceisusedbothforlookingupwhatactorstonotifyoftheevents,andforprovidingdefaultimplementationsforthoselistenersthatarenotinterestedinallevents.
position_changed(position)Calledwheneverthepositionofthestreamchanges.
MAYbeimplementedbyactor.
Parametersposition(int)–Positioninmilliseconds.
reached_end_of_stream()Calledwhenevertheendoftheaudiostreamisreached.
MAYbeimplementedbyactor.
staticsend(event,**kwargs)Helpertoallowcallingofaudiolistenereventsstate_changed(old_state,new_state,target_state)Calledaftertheplaybackstatehavechanged.
WillbecalledforbothimmediateandasyncstatechangesinGStreamer.
Targetstateisusedtowhenweshouldbeinthetargetstate,buttemporarilyneedtoswitchtoanotherstate.
Atypicalexampleofthisisbuffering.
Whenthishappensaneventwithold=PLAYING,new=PAUSED,target=PLAYINGwillbeemitted.
Oncewehavecaughtupaold=PAUSED,new=PLAYING,target=Noneeventwillbebegenerated.
Regularstatechangeswillnothavetargetstatesetastheyarenalstateswhichshouldbestable.
MAYbeimplementedbyactor.
Parametersold_state(stringfrommopidy.
core.
PlaybackStateeld)–thestatebeforethechangenew_state(stringfrommopidy.
core.
PlaybackStateeld)–thestateafterthechangetarget_state(stringfrommopidy.
core.
PlaybackStateeldorNoneifthisisanalstate.
)–theintendedstatestream_changed(uri)Calledwhenevertheaudiostreamchanges.
MAYbeimplementedbyactor.
Parametersuri(string)–URIthestreamhasstartedplaying.
tags_changed(tags)Calledwheneverthecurrentaudiostream'stagschange.
Thiseventsignalsthatsometrackmetadatahasbeenupdated.
Thiscanbemetadatasuchasartists,titles,organization,ordetailsabouttheactualaudiosuchasbit-rates,numbersofchannelsetc.
FortheavailabletagkeyspleaserefertoGStreamerdocumentationfortags.
MAYbeimplementedbyactor.
188Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfParameterstags(setofstrings)–Thetagsthathavejustbeenupdated.
Audioscannerclassmopidy.
audio.
scan.
Scanner(timeout=1000,proxy_cong=None)HelpertogettagsandotherrelevantinfofromURIs.
Parameterstimeout–timeoutforscanningaURIinmsproxy_config–dictionarycontainingproxycongstrings.
scan(uri,timeout=None)Scanthegivenuricollectingrelevantmetadata.
Parametersuri(string)–URIoftheresourcetoscan.
timeout(int)–timeoutforscanningaURIinms.
Defaultstothetimeoutvalueusedwhencreatingthescanner.
ReturnsAnamedtuplecontaining(uri,tags,duration,seekable,mime).
tagsisadictionaryoflistsforallthetagswefound.
durationisthelengthoftheURIinmilliseconds,orNoneiftheURIhasnoduration.
seekableisboolean.
indicatingifaseekwouldsucceed.
Audioutilsclassmopidy.
audio.
utils.
SignalsHelperfortrackinggobjectsignalregistrationsclear()Clearallregisteredsignalhandlers.
connect(element,event,func,*args)Connectafunction+argstosignaleventonanelement.
Eacheventmayonlybehandledbyonecallbackinthisimplementation.
disconnect(element,event)Disconnectwhateverhandlerwehaveforanelement+eventpair.
Doesnothingitthehandlerhasalreadybeenremoved.
mopidy.
audio.
utils.
calculate_duration(num_samples,sample_rate)DeterminedurationofsamplesusingGStreamerhelperforprecisemath.
mopidy.
audio.
utils.
clocktime_to_millisecond(value)ConvertaninternalGStreamertimetomillisecondtime.
mopidy.
audio.
utils.
create_buffer(data,timestamp=None,duration=None)CreateanewGStreamerbufferbasedonprovideddata.
Mainlyintendedtokeepgstimportsoutofnon-audiomodules.
Changedinversion2.
0:capabilitesargumentwasremoved.
mopidy.
audio.
utils.
millisecond_to_clocktime(value)ConvertamillisecondtimetointernalGStreamertime.
24.
4.
Audio189MopidyDocumentation,Release3.
1.
1-1-gf17acacfmopidy.
audio.
utils.
setup_proxy(element,cong)CongureaGStreamerelementwithproxysettings.
Parameterselement(Gst.
GstElement)–elementtosetupproxyin.
config(dict)–proxysettingstouse.
mopidy.
audio.
utils.
supported_uri_schemes(uri_schemes)DeterminewhichURIswecanactuallysupportfromprovidedwhitelist.
Parametersuri_schemes(listorsetorURIschemesasstrings.
)–list/setofURIstochecksupportfor.
ReturntypesetofURIschemeswecansupportviathisGStreamerinstall.
24.
4.
2mopidy.
mixer—AudiomixerAPIclassmopidy.
mixer.
Mixer(cong)AudiomixerAPIIfthemixerhasproblemsduringinitializationitshouldraisemopidy.
exceptions.
MixerErrorwithadescriptiveerrormessage.
ThiswillmakeMopidyprinttheerrormessageandexitsothattheusercanxtheissue.
Parametersconfig(dict)–theentireMopidycongurationget_mute()Getmutestateofthemixer.
MAYbeimplementedbysubclass.
ReturntypeTrueifmuted,Falseifunmuted,Noneifunknown.
get_volume()Getvolumelevelofthemixeronalinearscalefrom0to100.
Examplevalues:0:Minimumvolume,usuallysilent.
100:Maximumvolume.
None:Volumeisunknown.
MAYbeimplementedbysubclass.
Returntypeintinrange[0.
.
100]orNonename=NoneNameofthemixer.
Usedwhenconguringwhatmixertouse.
Shouldmatchtheext_nameoftheextensionprovidingthemixer.
ping()Calledtocheckiftheactorisstillalive.
set_mute(mute)Muteorunmutethemixer.
MAYbeimplementedbysubclass.
Parametersmute(bool)–Truetomute,Falsetounmute190Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfReturntypeTrueifsuccess,Falseiffailureset_volume(volume)Setvolumelevelofthemixer.
MAYbeimplementedbysubclass.
Parametersvolume(int)–Volumeintherange[0.
.
100]ReturntypeTrueifsuccess,Falseiffailuretrigger_mute_changed(mute)Sendmute_changedeventtoallmixerlisteners.
Thismethodshouldbecalledbysubclasseswhenthemutestateischanged,eitherbecauseofacalltoset_mute()orbecauseofanyexternalentitychangingthemutestate.
trigger_volume_changed(volume)Sendvolume_changedeventtoallmixerlisteners.
Thismethodshouldbecalledbysubclasseswhenthevolumeischanged,eitherbecauseofacalltoset_volume()orbecauseofanyexternalentitychangingthevolume.
classmopidy.
mixer.
MixerListenerMarkerinterfaceforrecipientsofeventssentbythemixeractor.
AnyPykkaactorthatmixesinthisclasswillreceivecallstothemethodsdenedherewhenthecorrespondingeventshappeninthemixeractor.
Thisinterfaceisusedbothforlookingupwhatactorstonotifyoftheevents,andforprovidingdefaultimplementationsforthoselistenersthatarenotinterestedinallevents.
mute_changed(mute)Calledafterthemutestatehaschanged.
MAYbeimplementedbyactor.
Parametersmute(bool)–Trueifmuted,Falseifnotmutedstaticsend(event,**kwargs)Helpertoallowcallingofmixerlistenereventsvolume_changed(volume)Calledafterthevolumehaschanged.
MAYbeimplementedbyactor.
Parametersvolume(intinrange[0.
.
100])–thenewvolumeMixerimplementationsSeetheextensionregistry.
24.
5Utilities24.
5.
1mopidy.
commands—CommandsAPIclassmopidy.
commands.
CommandCommandparserandrunnerforbuildingtreesofcommands.
Thisclassprovidesawraperaroundargparse.
ArgumentParserforhandlingthistypeofcommandlineapplicationinabetterwaythanargprasesownsub-parserhandling.
24.
5.
Utilities191MopidyDocumentation,Release3.
1.
1-1-gf17acacfadd_argument(*args,**kwargs)Addanargumenttotheparser.
Thismethodtakesallthesameargumentsastheargparse.
ArgumentParserversionofthismethod.
add_child(name,command)Addachildparsertoconsiderusing.
Parametersname(string)–nametouseforthesub-commandthatisbeingadded.
exit(status_code=0,message=None,usage=None)Optionallyprintamessageandexit.
format_help(prog=None)Formathelpforcurrentparserandchildren.
format_usage(prog=None)Formatusageforcurrentparser.
parse(args,prog=None)Parsecommandlinearguments.
Willrecursivelyparsecommandsuntilanalparserisfoundoranerroroccurs.
Inthecaseoferrorswewillprintamessageandexit.
Otherwise,anyoverridesareappliedandthecurrentparserstoredinthecommandattributeofthereturnvalue.
Parametersargs(listofstrings)–listofargumentstoparseprog(string)–nametouseforprogramReturntypeargparse.
Namespacerun(*args,**kwargs)Runthecommand.
Mustbeimplementedbysub-classesthatarenotsimplyanintermediateinthecommandnamespace.
set(**kwargs)Overrideavalueinthenalyresultofparsing.
classmopidy.
commands.
ConfigCommandrun(cong,errors,schemas)Runthecommand.
Mustbeimplementedbysub-classesthatarenotsimplyanintermediateinthecommandnamespace.
classmopidy.
commands.
DepsCommandrun()Runthecommand.
Mustbeimplementedbysub-classesthatarenotsimplyanintermediateinthecommandnamespace.
classmopidy.
commands.
RootCommandrun(args,cong)Runthecommand.
Mustbeimplementedbysub-classesthatarenotsimplyanintermediateinthecommandnamespace.
192Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacf24.
5.
2mopidy.
config—CongAPIclassmopidy.
config.
ConfigValueRepresentsacongkey'svalueandhowtohandleit.
Normallyyouwillonlybeinteractingwithsub-classesforcongvaluesthatencodeeitherdeserializationbe-haviorand/orvalidation.
Eachcongvalueshouldbeusedforthefollowingactions:1.
Deserializingfromarawstringandvalidating,raisingValueErroronfailure.
2.
Serializingavaluebacktoastringthatcanbestoredinacong.
3.
Formattingavaluetoaprintableform(usefulformaskingsecrets).
Nonevaluesshouldnotbedeserialized,serializedorformatted,thecodeinteractingwiththecongshouldsimplyskipNonecongvalues.
deserialize(value)Castrawstringtoappropriatetype.
serialize(value,display=False)Convertvaluebacktostringforsaving.
classmopidy.
config.
List(optional=False)Listvalue.
Supportselementssplitbycommasornewlines.
Newlinestakepresedenceandemptylistitemswillbelteredout.
deserialize(value)Castrawstringtoappropriatetype.
serialize(value,display=False)Convertvaluebacktostringforsaving.
Congsectionschemasclassmopidy.
config.
schemas.
ConfigSchema(name)Logicalgroupofcongvaluesthatcorrespondtoacongsection.
Schemasaresetupbyassigningcongkeyswithcongvaluestoinstances.
Oncesetupdeserialize()canbecalledwithadictofvaluestoprocess.
Forconvieniencewealsosupportformat()methodthatcanusedforconvertingthevaluestoadictthatcanbeprintedandserialize()forconvertingthevaluestoaformsuitableforpersistence.
deserialize(values)Validatesthegivenvaluesusingthecongschema.
Returnsatuplewithcleanedvaluesanderrors.
serialize(values,display=False)Convertsthegivenvaluestoaformatsuitableforpersistence.
IfdisplayisTruesecretcongvalues,likepasswords,willbemaskedout.
Returnsadictofcongkeysandvalues.
classmopidy.
config.
schemas.
MapConfigSchema(name,value_type)Schemaforhandlingmultipleunknownkeyswiththesametype.
Doesnotsub-classConfigSchema,butimplementsthesameserialize/deserializeinterface.
24.
5.
Utilities193MopidyDocumentation,Release3.
1.
1-1-gf17acacfCongvaluetypesclassmopidy.
config.
types.
Boolean(optional=False)Booleanvalue.
Accepts1,yes,true,andonwithanycasingasTrue.
Accepts0,no,false,andoffwithanycasingasFalse.
deserialize(value)Castrawstringtoappropriatetype.
serialize(value,display=False)Convertvaluebacktostringforsaving.
classmopidy.
config.
types.
ConfigValueRepresentsacongkey'svalueandhowtohandleit.
Normallyyouwillonlybeinteractingwithsub-classesforcongvaluesthatencodeeitherdeserializationbe-haviorand/orvalidation.
Eachcongvalueshouldbeusedforthefollowingactions:1.
Deserializingfromarawstringandvalidating,raisingValueErroronfailure.
2.
Serializingavaluebacktoastringthatcanbestoredinacong.
3.
Formattingavaluetoaprintableform(usefulformaskingsecrets).
Nonevaluesshouldnotbedeserialized,serializedorformatted,thecodeinteractingwiththecongshouldsimplyskipNonecongvalues.
deserialize(value)Castrawstringtoappropriatetype.
serialize(value,display=False)Convertvaluebacktostringforsaving.
classmopidy.
config.
types.
DeprecatedDeprecatedvalue.
Usedforignoringoldcongvaluesthatarenolongerinuse,butshouldnotcausethecongparsertocrash.
deserialize(value)Castrawstringtoappropriatetype.
serialize(value,display=False)Convertvaluebacktostringforsaving.
classmopidy.
config.
types.
Hostname(optional=False)Networkhostnamevalue.
deserialize(value,display=False)Castrawstringtoappropriatetype.
classmopidy.
config.
types.
Integer(minimum=None,maximum=None,choices=None,op-tional=False)Integervalue.
deserialize(value)Castrawstringtoappropriatetype.
classmopidy.
config.
types.
List(optional=False)Listvalue.
194Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacfSupportselementssplitbycommasornewlines.
Newlinestakepresedenceandemptylistitemswillbelteredout.
deserialize(value)Castrawstringtoappropriatetype.
serialize(value,display=False)Convertvaluebacktostringforsaving.
classmopidy.
config.
types.
LogColordeserialize(value)Castrawstringtoappropriatetype.
serialize(value,display=False)Convertvaluebacktostringforsaving.
classmopidy.
config.
types.
LogLevelLoglevelvalue.
Expectsoneofcritical,error,warning,info,debug,orall,withanycasing.
deserialize(value)Castrawstringtoappropriatetype.
serialize(value,display=False)Convertvaluebacktostringforsaving.
classmopidy.
config.
types.
Path(optional=False)Filesystempath.
Thefollowingexpansionsofthepathwillbedone:~tothecurrentuser'shomedirectory$XDG_CACHE_DIRaccordingtotheXDGspec$XDG_CONFIG_DIRaccordingtotheXDGspec$XDG_DATA_DIRaccordingtotheXDGspec$XDG_MUSIC_DIRaccordingtotheXDGspecdeserialize(value)Castrawstringtoappropriatetype.
serialize(value,display=False)Convertvaluebacktostringforsaving.
classmopidy.
config.
types.
Port(choices=None,optional=False)Networkportvalue.
Expectsintegerintherange0-65535,zerotellsthekerneltosimplyallocateaportforus.
classmopidy.
config.
types.
Secret(optional=False,choices=None)Secretstringvalue.
Isdecodedasutf-8andntescapesshouldworkandbepreserved.
Shouldbeusedforpasswords,authtokensetc.
Willmaskvaluewhenbeingdisplayed.
serialize(value,display=False)Convertvaluebacktostringforsaving.
24.
5.
Utilities195MopidyDocumentation,Release3.
1.
1-1-gf17acacfclassmopidy.
config.
types.
String(optional=False,choices=None)Stringvalue.
Isdecodedasutf-8andntescapesshouldworkandbepreserved.
deserialize(value)Castrawstringtoappropriatetype.
serialize(value,display=False)Convertvaluebacktostringforsaving.
Congvaluevalidatorsmopidy.
config.
validators.
validate_choice(value,choices)ValidatethatvalueisoneofthechoicesNormallycalledindeserialize().
mopidy.
config.
validators.
validate_maximum(value,maximum)ValidatethatvalueisatmostmaximumNormallycalledindeserialize().
mopidy.
config.
validators.
validate_minimum(value,minimum)ValidatethatvalueisatleastminimumNormallycalledindeserialize().
mopidy.
config.
validators.
validate_required(value,required)ValidatethatvalueissetifrequiredNormallycalledindeserialize()ontherawstring,_not_theconvertedvalue.
24.
5.
3mopidy.
httpclient—HTTPClienthelpersmopidy.
httpclient.
format_proxy(proxy_cong,auth=True)ConvertaMopidyproxycongtothecommonlyusedproxystringformat.
Outputsscheme://host:port,scheme://user:pass@host:portorNonedependingontheproxycongprovided.
YoucanalsooptoutofgettingthebasicauthbysettingauthtoFalse.
Newinversion1.
1.
mopidy.
httpclient.
format_user_agent(name=None)ConstructaUser-Agentsuitableforuseinclientcode.
Thiswillidentifyusebytheprovidedname(whichshouldbeontheformatdist_name/version),MopidyversionandPythonversion.
Newinversion1.
1.
196Chapter24.
APIreferenceMopidyDocumentation,Release3.
1.
1-1-gf17acacf24.
5.
4mopidy.
zeroconf—ZeroconfAPIclassmopidy.
zeroconf.
Zeroconf(name,stype,port,domain='',host='',text=None)PublishanetworkservicewithZeroconf.
Currently,thisonlyworksonLinuxusingAvahiviaD-Bus.
Parametersname(str)–humanreadablenameoftheservice,e.
g.
'MPDonneptune'stype(str)–servicetype,e.
g.
'_mpd.
_tcp'port(int)–TCPportoftheservice,e.
g.
6600domain(str)–localnetworkdomainname,defaultsto''host(str)–interfacetoadvertisetheserviceon,defaultsto''text(listofstr)–extrainformationdependingonstype,defaultstoemptylistpublish()Publishtheservice.
Callwhenyourservicestarts.
unpublish()Unpublishtheservice.
Callwhenyourserviceshutsdown.
24.
5.
Utilities197MopidyDocumentation,Release3.
1.
1-1-gf17acacf198Chapter24.
APIreferenceCHAPTERTWENTYFIVEMOPIDYCOMMAND25.
1Synopsismopidy[-h][–version][-q][-v][–congCONFIG_FILES][-oCONFIG_OVERRIDES][COMMAND].
.
.
25.
2DescriptionMopidyisamusicserverwhichcanplaymusicbothfrommultiplesources,likeyourlocalharddrive,radiostreams,andfromSpotifyandSoundCloud.
Searchescombinesresultsfromallmusicsources,andyoucanmixtracksfromallsourcesinyourplayqueue.
YourplaylistsfromSpotifyorSoundCloudarealsoavailableforuse.
Themopidycommandisusedtostarttheserver.
25.
3Options--help,-hShowhelpmessageandexit.
--versionShowMopidy'sversionnumberandexit.
--quiet,-qShowlessoutput:warninglevelandhigher.
--verbose,-vShowmoreoutput.
Repeatuptofourtimesforevenmore.
--configSpecifyconglesanddirectoriestouse.
Tousemultipleconglesordirectories,separatethemwithacolon.
Thelaterlesoverridetheearlieronesifthere'saconict.
Whenspecifyingadirectory,alllesendingin.
confinthedirectoryareused.
--option,-oSpecifyadditionalcongvaluesinthesection/key=valueformat.
Canbeprovidedmultipletimes.
199MopidyDocumentation,Release3.
1.
1-1-gf17acacf25.
4BuiltincommandsconfigShowthecurrenteffectivecong.
Allcongurationsourcesaremergedtogethertoshowtheeffectivedocument.
Secretvalueslikepasswordsaremaskedout.
Congfordisabledextensionsarenotincluded.
depsShowdependencies,theirversionsandinstallationlocation.
25.
5ExtensioncommandsAdditionally,extensionscanprovideextracommands.
Runmopidy–helpforalistofwhatisavailableonyoursystemandcommand-specichelp.
Commandsfordisabledextensionswillbelisted,butcannotberun.
25.
6Files/etc/mopidy/mopidy.
confSystemwideMopidycongurationle.
~/.
config/mopidy/mopidy.
confYourpersonalMopidycongurationle.
Overridesanycongsfromthesystemwidecongurationle.
25.
7ExamplesTostartthemusicserver,run:mopidyTostarttheserverwithanadditionalcongle,thatcanoverridecongssetinthedefaultcongles,run:mopidy--config.
/my-config.
confTostarttheserverandchangeacongvaluedirectlyonthecommandline,run:mopidy--optionmpd/enabled=falseThe--optionagmayberepeatedmultipletimestochangemultiplecongs:mopidy-ompd/enabled=false-ospotify/bitrate=320Themopidyconfigoutputshowstheeffectofthe--optionags:mopidy-ompd/enabled=false-ospotify/bitrate=320config200Chapter25.
mopidycommandMopidyDocumentation,Release3.
1.
1-1-gf17acacf25.
8ReportingbugsReportbugstoMopidy'sissuetrackerat25.
8.
Reportingbugs201MopidyDocumentation,Release3.
1.
1-1-gf17acacf202Chapter25.
mopidycommandCHAPTERTWENTYSIXGLOSSARYbackendApartofMopidyprovidingmusiclibrary,playliststorageand/orplaybackcapabilitytothecore.
Mopidyhasabackendforeachmusicstoreormusicserviceitsupports.
Seemopidy.
backend—BackendAPIfordetails.
coreThepartofMopidythatmakesmultiplefrontendscapableofusingmultiplebackends.
Thecoremoduleisalsotheownerofthetracklist.
Tousethecoremodule,seemopidy.
core—CoreAPI.
extensionAPythonpackagethatcanextendMopidywithoneormorebackends,frontends,mixers,orwebclients.
SeetheextensionregistryforavailableMopidyextensions.
SeeExtensiondevelopmentforhowtomakeanewextension.
frontendApartofMopidyusingthecoreAPI.
ExistingfrontendsincludetheMPDserver,theMPRIS/D-Businte-gration,theLast.
fmscrobbler,andtheHTTPserver.
SeeFrontendAPIfordetails.
mixerApartofMopidythatcontrolsaudiovolumeandmuting.
tracklistMopidy'snamefortheplayqueueorcurrentplaylist.
ThenameisinspiredbytheMPRISspecication.
203MopidyDocumentation,Release3.
1.
1-1-gf17acacf204Chapter26.
GlossaryCHAPTERTWENTYSEVENINDICESANDTABLESgenindexmodindex205MopidyDocumentation,Release3.
1.
1-1-gf17acacf206Chapter27.
IndicesandtablesPYTHONMODULEINDEXamopidy.
audio,185mopidy.
audio.
utils,189bmopidy.
backend,173cmopidy.
commands,191mopidy.
config,193mopidy.
config.
schemas,193mopidy.
config.
types,194mopidy.
config.
validators,196mopidy.
core,159emopidy.
ext,179hmopidy.
httpclient,196mmopidy.
mixer,190mopidy.
models,152zmopidy.
zeroconf,197207MopidyDocumentation,Release3.
1.
1-1-gf17acacf208PythonModuleIndexINDEXSymbols--configmopidycommandlineoption,199--helpmopidycommandlineoption,199--optionmopidycommandlineoption,199--quietmopidycommandlineoption,199--verbosemopidycommandlineoption,199--versionmopidycommandlineoption,199-hmopidycommandlineoption,199-omopidycommandlineoption,199-qmopidycommandlineoption,199-vmopidycommandlineoption,199Aadd()(mopidy.
core.
TracklistControllermethod),160add()(mopidy.
ext.
Registrymethod),180add_argument()(mopidy.
commands.
Commandmethod),191add_child()(mopidy.
commands.
Commandmethod),192Album(classinmopidy.
models),154ALBUM(mopidy.
models.
Refattribute),152album(mopidy.
models.
Trackattribute),154album()(mopidy.
models.
Refclassmethod),153albums(mopidy.
models.
SearchResultattribute),156Artist(classinmopidy.
models),155ARTIST(mopidy.
models.
Refattribute),152artist()(mopidy.
models.
Refclassmethod),153artists(mopidy.
models.
Albumattribute),154artists(mopidy.
models.
SearchResultattribute),156artists(mopidy.
models.
Trackattribute),154as_list()(mopidy.
backend.
PlaylistsProvidermethod),176as_list()(mopidy.
core.
PlaylistsControllermethod),168Audio(classinmopidy.
audio),185audio(mopidy.
backend.
Backendattribute),174audio/buffer_timeconfigurationvalue,19audio/mixerconfigurationvalue,19audio/mixer_volumeconfigurationvalue,19audio/outputconfigurationvalue,19AudioListener(classinmopidy.
audio),188Bbackend,203Backend(classinmopidy.
backend),174BackendListener(classinmopidy.
backend),178bitrate(mopidy.
models.
Trackattribute),154Boolean(classinmopidy.
cong.
types),194browse()(mopidy.
backend.
LibraryProvidermethod),177browse()(mopidy.
core.
LibraryControllermethod),166Ccalculate_duration()(inmodulemopidy.
audio.
utils),189change_track()(mopidy.
backend.
PlaybackProvidermethod),174clear()(mopidy.
audio.
utils.
Signalsmethod),189clear()(mopidy.
core.
TracklistControllermethod),160clocktime_to_millisecond()(inmodulemopidy.
audio.
utils),189Collection(classinmopidy.
models.
elds),159Command(classinmopidy.
commands),191command()(mopidy.
ext.
ExtensionDataproperty),180comment(mopidy.
models.
Trackattribute),154composers(mopidy.
models.
Trackattribute),154configmopidycommandlineoption,200209MopidyDocumentation,Release3.
1.
1-1-gf17acacfconfig_defaults()(mopidy.
ext.
ExtensionDataproperty),180config_schema()(mopidy.
ext.
ExtensionDataprop-erty),180ConfigCommand(classinmopidy.
commands),192ConfigSchema(classinmopidy.
cong.
schemas),193configurationvalueaudio/buffer_time,19audio/mixer,19audio/mixer_volume,19audio/output,19core/cache_dir,18core/config_dir,18core/data_dir,18core/max_tracklist_length,19core/restore_state,19file/enabled,29file/excluded_file_extensions,29file/follow_symlinks,30file/media_dirs,29file/metadata_timeout,30file/show_dotfiles,29http/allowed_origins,36http/csrf_protection,36http/default_app,36http/enabled,35http/hostname,35http/port,36http/zeroconf,36logcolors/*,20logging/color,20logging/config_file,20logging/format,20logging/verbosity,20loglevels/*,20m3u/base_dir,31m3u/default_encoding,31m3u/default_extension,31m3u/enabled,31m3u/playlists_dir,31proxy/hostname,20proxy/password,20proxy/port,20proxy/scheme,20proxy/username,20softwaremixer/enabled,37stream/enabled,33stream/metadata_blacklist,33stream/protocols,33stream/timeout,33ConfigValue(classinmopidy.
cong),193ConfigValue(classinmopidy.
cong.
types),194connect()(mopidy.
audio.
utils.
Signalsmethod),189core,203Core(classinmopidy.
core),159core/cache_dirconfigurationvalue,18core/config_dirconfigurationvalue,18core/data_dirconfigurationvalue,18core/max_tracklist_lengthconfigurationvalue,19core/restore_stateconfigurationvalue,19CoreListener(classinmopidy.
core),170create()(mopidy.
backend.
PlaylistsProvidermethod),176create()(mopidy.
core.
PlaylistsControllermethod),169create_buffer()(inmodulemopidy.
audio.
utils),189DDate(classinmopidy.
models.
elds),159date(mopidy.
models.
Albumattribute),155date(mopidy.
models.
Trackattribute),154delete()(mopidy.
backend.
PlaylistsProvidermethod),176delete()(mopidy.
core.
PlaylistsControllermethod),169Deprecated(classinmopidy.
cong.
types),194depsmopidycommandlineoption,200DepsCommand(classinmopidy.
commands),192deserialize()(mopidy.
cong.
CongValuemethod),193deserialize()(mopidy.
cong.
Listmethod),193deserialize()(mopidy.
cong.
schemas.
CongSchemamethod),193deserialize()(mopidy.
cong.
types.
Booleanmethod),194deserialize()(mopidy.
cong.
types.
CongValuemethod),194deserialize()(mopidy.
cong.
types.
Deprecatedmethod),194deserialize()(mopidy.
cong.
types.
Hostnamemethod),194deserialize()(mopidy.
cong.
types.
Integermethod),194deserialize()(mopidy.
cong.
types.
Listmethod),195deserialize()(mopidy.
cong.
types.
LogColormethod),195deserialize()(mopidy.
cong.
types.
LogLevelmethod),195deserialize()(mopidy.
cong.
types.
Pathmethod),195210IndexMopidyDocumentation,Release3.
1.
1-1-gf17acacfdeserialize()(mopidy.
cong.
types.
Stringmethod),196DIRECTORY(mopidy.
models.
Refattribute),153directory()(mopidy.
models.
Refclassmethod),153disc_no(mopidy.
models.
Trackattribute),154disconnect()(mopidy.
audio.
utils.
Signalsmethod),189DISPLAY,85dist_name(mopidy.
ext.
Extensionattribute),179Eemit_data()(mopidy.
audio.
Audiomethod),185enable_sync_handler()(mopidy.
audio.
Audiomethod),185entry_point()(mopidy.
ext.
ExtensionDataproperty),180environmentvariableDISPLAY,85GST_DEBUG,27,85GST_DEBUG_DUMP_DOT_DIR,27GST_DEBUG_FILE=gstreamer.
log,27eot_track()(mopidy.
core.
TracklistControllermethod),162exit()(mopidy.
commands.
Commandmethod),192ext_name(mopidy.
ext.
Extensionattribute),179extension,203Extension(classinmopidy.
ext),179extension()(mopidy.
ext.
ExtensionDataproperty),180ExtensionData(classinmopidy.
ext),180FField(classinmopidy.
models.
elds),158file/enabledconfigurationvalue,29file/excluded_file_extensionsconfigurationvalue,29file/follow_symlinksconfigurationvalue,30file/media_dirsconfigurationvalue,29file/metadata_timeoutconfigurationvalue,30file/show_dotfilesconfigurationvalue,29filter()(mopidy.
core.
TracklistControllermethod),161format_help()(mopidy.
commands.
Commandmethod),192format_proxy()(inmodulemopidy.
httpclient),196format_usage()(mopidy.
commands.
Commandmethod),192format_user_agent()(inmodulemopidy.
httpclient),196frontend,203Ggenre(mopidy.
models.
Trackattribute),154get_cache_dir()(mopidy.
ext.
Extensionclassmethod),179get_command()(mopidy.
ext.
Extensionmethod),179get_config_dir()(mopidy.
ext.
Extensionclassmethod),179get_config_schema()(mopidy.
ext.
Extensionmethod),179get_consume()(mopidy.
core.
TracklistControllermethod),163get_current_tags()(mopidy.
audio.
Audiomethod),186get_current_tl_track()(mopidy.
core.
PlaybackControllermethod),165get_current_track()(mopidy.
core.
PlaybackControllermethod),165get_data_dir()(mopidy.
ext.
Extensionclassmethod),179get_default_config()(mopidy.
ext.
Extensionmethod),179get_distinct()(mopidy.
backend.
LibraryProvidermethod),177get_distinct()(mopidy.
core.
LibraryControllermethod),167get_eot_tlid()(mopidy.
core.
TracklistControllermethod),162get_history()(mopidy.
core.
HistoryControllermethod),170get_images()(mopidy.
backend.
LibraryProvidermethod),177get_images()(mopidy.
core.
LibraryControllermethod),167get_items()(mopidy.
backend.
PlaylistsProvidermethod),176get_items()(mopidy.
core.
PlaylistsControllermethod),168get_length()(mopidy.
core.
HistoryControllermethod),170get_length()(mopidy.
core.
TracklistControllermethod),161get_mute()(mopidy.
core.
MixerControllermethod),169get_mute()(mopidy.
mixer.
Mixermethod),190get_next_tlid()(mopidy.
core.
TracklistControllermethod),162get_position()(mopidy.
audio.
Audiomethod),186get_previous_tlid()(mopidy.
core.
TracklistControllermethod),162Index211MopidyDocumentation,Release3.
1.
1-1-gf17acacfget_random()(mopidy.
core.
TracklistControllermethod),163get_repeat()(mopidy.
core.
TracklistControllermethod),163get_single()(mopidy.
core.
TracklistControllermethod),164get_state()(mopidy.
core.
PlaybackControllermethod),165get_stream_title()(mopidy.
core.
PlaybackControllermethod),165get_time_position()(mopidy.
backend.
PlaybackProvidermethod),174get_time_position()(mopidy.
core.
PlaybackControllermethod),165get_tl_tracks()(mopidy.
core.
TracklistControllermethod),161get_tracks()(mopidy.
core.
TracklistControllermethod),161get_uri_schemes()(mopidy.
core.
Coremethod),159get_uri_schemes()(mopidy.
core.
PlaylistsControllermethod),168get_version()(mopidy.
core.
Coremethod),160get_version()(mopidy.
core.
TracklistControllermethod),161get_volume()(mopidy.
core.
MixerControllermethod),170get_volume()(mopidy.
mixer.
Mixermethod),190GST_DEBUG,27,85GST_DEBUG_DUMP_DOT_DIR,27GST_DEBUG_FILE=gstreamer.
log,27Hheight(mopidy.
models.
Imageattribute),156history(mopidy.
core.
Coreattribute),159Hostname(classinmopidy.
cong.
types),194http/allowed_originsconfigurationvalue,36http/csrf_protectionconfigurationvalue,36http/default_appconfigurationvalue,36http/enabledconfigurationvalue,35http/hostnameconfigurationvalue,35http/portconfigurationvalue,36http/zeroconfconfigurationvalue,36IIdentifier(classinmopidy.
models.
elds),158Image(classinmopidy.
models),156ImmutableObject(classinmopidy.
models),157index()(mopidy.
core.
TracklistControllermethod),161Integer(classinmopidy.
cong.
types),194Integer(classinmopidy.
models.
elds),159is_live()(mopidy.
backend.
PlaybackProvidermethod),175Llast_modified(mopidy.
models.
Playlistattribute),155last_modified(mopidy.
models.
Trackattribute),154length(mopidy.
models.
Trackattribute),154length()(mopidy.
models.
Playlistproperty),155library(mopidy.
backend.
Backendattribute),174library(mopidy.
core.
Coreattribute),159LibraryProvider(classinmopidy.
backend),177List(classinmopidy.
cong),193List(classinmopidy.
cong.
types),194load_extensions()(inmodulemopidy.
ext),180LogColor(classinmopidy.
cong.
types),195logcolors/*configurationvalue,20logging/colorconfigurationvalue,20logging/config_fileconfigurationvalue,20logging/formatconfigurationvalue,20logging/verbosityconfigurationvalue,20LogLevel(classinmopidy.
cong.
types),195loglevels/*configurationvalue,20lookup()(mopidy.
backend.
LibraryProvidermethod),178lookup()(mopidy.
backend.
PlaylistsProvidermethod),177lookup()(mopidy.
core.
LibraryControllermethod),167lookup()(mopidy.
core.
PlaylistsControllermethod),168Mm3u/base_dirconfigurationvalue,31m3u/default_encodingconfigurationvalue,31m3u/default_extensionconfigurationvalue,31m3u/enabledconfigurationvalue,31212IndexMopidyDocumentation,Release3.
1.
1-1-gf17acacfm3u/playlists_dirconfigurationvalue,31MapConfigSchema(classinmopidy.
cong.
schemas),193millisecond_to_clocktime()(inmodulemopidy.
audio.
utils),189mixer,203Mixer(classinmopidy.
mixer),190mixer(mopidy.
audio.
Audioattribute),186mixer(mopidy.
core.
Coreattribute),159MixerListener(classinmopidy.
mixer),191model_json_decoder()(inmodulemopidy.
models),158ModelJSONEncoder(classinmopidy.
models),158modulemopidy.
audio,185mopidy.
audio.
utils,189mopidy.
backend,173mopidy.
commands,191mopidy.
config,193mopidy.
config.
schemas,193mopidy.
config.
types,194mopidy.
config.
validators,196mopidy.
core,159mopidy.
ext,179mopidy.
httpclient,196mopidy.
mixer,190mopidy.
models,152mopidy.
zeroconf,197mopidycommandlineoption--config,199--help,199--option,199--quiet,199--verbose,199--version,199-h,199-o,199-q,199-v,199config,200deps,200mopidy.
audiomodule,185mopidy.
audio.
utilsmodule,189mopidy.
backendmodule,173mopidy.
commandsmodule,191mopidy.
configmodule,193mopidy.
config.
schemasmodule,193mopidy.
config.
typesmodule,194mopidy.
config.
validatorsmodule,196mopidy.
coremodule,159mopidy.
core.
HistoryController(classinmopidy.
core),170mopidy.
core.
LibraryController(classinmopidy.
core),166mopidy.
core.
MixerController(classinmopidy.
core),169mopidy.
core.
PlaybackState(classinmopidy.
core),165mopidy.
core.
PlaylistsController(classinmopidy.
core),168mopidy.
extmodule,179mopidy.
httpclientmodule,196mopidy.
mixermodule,190mopidy.
modelsmodule,152mopidy.
zeroconfmodule,197move()(mopidy.
core.
TracklistControllermethod),160musicbrainz_id(mopidy.
models.
Albumattribute),155musicbrainz_id(mopidy.
models.
Artistattribute),155musicbrainz_id(mopidy.
models.
Trackattribute),154mute_changed()(mopidy.
core.
CoreListenermethod),170mute_changed()(mopidy.
mixer.
MixerListenermethod),191Nname(mopidy.
mixer.
Mixerattribute),190name(mopidy.
models.
Albumattribute),155name(mopidy.
models.
Artistattribute),155name(mopidy.
models.
Playlistattribute),155name(mopidy.
models.
Refattribute),153name(mopidy.
models.
Trackattribute),154next()(mopidy.
core.
PlaybackControllermethod),164next_track()(mopidy.
core.
TracklistControllermethod),162num_discs(mopidy.
models.
Albumattribute),155num_tracks(mopidy.
models.
Albumattribute),155Oon_event()(mopidy.
core.
CoreListenermethod),170on_start()(mopidy.
audio.
Audiomethod),186Index213MopidyDocumentation,Release3.
1.
1-1-gf17acacfon_stop()(mopidy.
audio.
Audiomethod),186options_changed()(mopidy.
core.
CoreListenermethod),170Pparse()(mopidy.
commands.
Commandmethod),192Path(classinmopidy.
cong.
types),195pause()(mopidy.
backend.
PlaybackProvidermethod),175pause()(mopidy.
core.
PlaybackControllermethod),164pause_playback()(mopidy.
audio.
Audiomethod),186PAUSED(mopidy.
core.
mopidy.
core.
PlaybackStateattribute),166performers(mopidy.
models.
Trackattribute),154ping()(mopidy.
backend.
Backendmethod),174ping()(mopidy.
mixer.
Mixermethod),190play()(mopidy.
backend.
PlaybackProvidermethod),175play()(mopidy.
core.
PlaybackControllermethod),164playback(mopidy.
backend.
Backendattribute),174playback(mopidy.
core.
Coreattribute),159playback_state_changed()(mopidy.
core.
CoreListenermethod),171PlaybackController(classinmopidy.
core),164PlaybackProvider(classinmopidy.
backend),174PLAYING(mopidy.
core.
mopidy.
core.
PlaybackStateat-tribute),166Playlist(classinmopidy.
models),155PLAYLIST(mopidy.
models.
Refattribute),153playlist()(mopidy.
models.
Refclassmethod),153playlist_changed()(mopidy.
core.
CoreListenermethod),171playlist_deleted()(mopidy.
core.
CoreListenermethod),171playlists(mopidy.
backend.
Backendattribute),174playlists(mopidy.
core.
Coreattribute),159playlists_loaded()(mopidy.
backend.
BackendListenermethod),178playlists_loaded()(mopidy.
core.
CoreListenermethod),171PlaylistsProvider(classinmopidy.
backend),176Port(classinmopidy.
cong.
types),195position_changed()(mopidy.
audio.
AudioListenermethod),188prepare_change()(mopidy.
audio.
Audiomethod),186prepare_change()(mopidy.
backend.
PlaybackProvidermethod),175previous()(mopidy.
core.
PlaybackControllermethod),164previous_track()(mopidy.
core.
TracklistControllermethod),163proxy/hostnameconfigurationvalue,20proxy/passwordconfigurationvalue,20proxy/portconfigurationvalue,20proxy/schemeconfigurationvalue,20proxy/usernameconfigurationvalue,20publish()(mopidy.
zeroconf.
Zeroconfmethod),197PythonEnhancementProposalsPEP20,143PEP386,95,132PEP396,95PEP8,143Rreached_end_of_stream()(mopidy.
audio.
AudioListenermethod),188Ref(classinmopidy.
models),152refresh()(mopidy.
backend.
LibraryProvidermethod),178refresh()(mopidy.
backend.
PlaylistsProvidermethod),177refresh()(mopidy.
core.
LibraryControllermethod),167refresh()(mopidy.
core.
PlaylistsControllermethod),168Registry(classinmopidy.
ext),180remove()(mopidy.
core.
TracklistControllermethod),160replace()(mopidy.
models.
ImmutableObjectmethod),157replace()(mopidy.
models.
ValidatedImmutableObjectmethod),157resume()(mopidy.
backend.
PlaybackProvidermethod),175resume()(mopidy.
core.
PlaybackControllermethod),164root_directory(mopidy.
backend.
LibraryProviderattribute),178RootCommand(classinmopidy.
commands),192run()(mopidy.
commands.
Commandmethod),192run()(mopidy.
commands.
CongCommandmethod),192run()(mopidy.
commands.
DepsCommandmethod),192run()(mopidy.
commands.
RootCommandmethod),192Ssave()(mopidy.
backend.
PlaylistsProvidermethod),177214IndexMopidyDocumentation,Release3.
1.
1-1-gf17acacfsave()(mopidy.
core.
PlaylistsControllermethod),169scan()(mopidy.
audio.
scan.
Scannermethod),189Scanner(classinmopidy.
audio.
scan),189search()(mopidy.
backend.
LibraryProvidermethod),178search()(mopidy.
core.
LibraryControllermethod),166SearchResult(classinmopidy.
models),156Secret(classinmopidy.
cong.
types),195seek()(mopidy.
backend.
PlaybackProvidermethod),175seek()(mopidy.
core.
PlaybackControllermethod),164seeked()(mopidy.
core.
CoreListenermethod),171send()(mopidy.
audio.
AudioListenerstaticmethod),188send()(mopidy.
backend.
BackendListenerstaticmethod),178send()(mopidy.
core.
CoreListenerstaticmethod),171send()(mopidy.
mixer.
MixerListenerstaticmethod),191serialize()(mopidy.
cong.
CongValuemethod),193serialize()(mopidy.
cong.
Listmethod),193serialize()(mopidy.
cong.
schemas.
CongSchemamethod),193serialize()(mopidy.
cong.
types.
Booleanmethod),194serialize()(mopidy.
cong.
types.
CongValuemethod),194serialize()(mopidy.
cong.
types.
Deprecatedmethod),194serialize()(mopidy.
cong.
types.
Listmethod),195serialize()(mopidy.
cong.
types.
LogColormethod),195serialize()(mopidy.
cong.
types.
LogLevelmethod),195serialize()(mopidy.
cong.
types.
Pathmethod),195serialize()(mopidy.
cong.
types.
Secretmethod),195serialize()(mopidy.
cong.
types.
Stringmethod),196set()(mopidy.
commands.
Commandmethod),192set_about_to_finish_callback()(mopidy.
audio.
Audiomethod),186set_appsrc()(mopidy.
audio.
Audiomethod),186set_consume()(mopidy.
core.
TracklistControllermethod),163set_metadata()(mopidy.
audio.
Audiomethod),187set_mute()(mopidy.
core.
MixerControllermethod),169set_mute()(mopidy.
mixer.
Mixermethod),190set_position()(mopidy.
audio.
Audiomethod),187set_random()(mopidy.
core.
TracklistControllermethod),163set_repeat()(mopidy.
core.
TracklistControllermethod),163set_single()(mopidy.
core.
TracklistControllermethod),164set_state()(mopidy.
core.
PlaybackControllermethod),165set_uri()(mopidy.
audio.
Audiomethod),187set_volume()(mopidy.
core.
MixerControllermethod),170set_volume()(mopidy.
mixer.
Mixermethod),191setup()(mopidy.
ext.
Extensionmethod),179setup_proxy()(inmodulemopidy.
audio.
utils),189should_download()(mopidy.
backend.
PlaybackProvidermethod),175shuffle()(mopidy.
core.
TracklistControllermethod),161Signals(classinmopidy.
audio.
utils),189slice()(mopidy.
core.
TracklistControllermethod),161softwaremixer/enabledconfigurationvalue,37sortname(mopidy.
models.
Artistattribute),155start_playback()(mopidy.
audio.
Audiomethod),187state(mopidy.
audio.
Audioattribute),187state_changed()(mopidy.
audio.
AudioListenermethod),188stop()(mopidy.
backend.
PlaybackProvidermethod),175stop()(mopidy.
core.
PlaybackControllermethod),164stop_playback()(mopidy.
audio.
Audiomethod),187STOPPED(mopidy.
core.
mopidy.
core.
PlaybackStateat-tribute),166stream/enabledconfigurationvalue,33stream/metadata_blacklistconfigurationvalue,33stream/protocolsconfigurationvalue,33stream/timeoutconfigurationvalue,33stream_changed()(mopidy.
audio.
AudioListenermethod),188stream_title_changed()(mopidy.
core.
CoreListenermethod),171String(classinmopidy.
cong.
types),195String(classinmopidy.
models.
elds),158supported_uri_schemes()(inmodulemopidy.
audio.
utils),190Ttags_changed()(mopidy.
audio.
AudioListenermethod),188Index215MopidyDocumentation,Release3.
1.
1-1-gf17acacftlid(mopidy.
models.
TlTrackattribute),156TlTrack(classinmopidy.
models),156Track(classinmopidy.
models),153TRACK(mopidy.
models.
Refattribute),153track(mopidy.
models.
TlTrackattribute),156track()(mopidy.
models.
Refclassmethod),153track_no(mopidy.
models.
Trackattribute),154track_playback_ended()(mopidy.
core.
CoreListenermethod),171track_playback_paused()(mopidy.
core.
CoreListenermethod),171track_playback_resumed()(mopidy.
core.
CoreListenermethod),172track_playback_started()(mopidy.
core.
CoreListenermethod),172tracklist,203tracklist(mopidy.
core.
Coreattribute),159tracklist_changed()(mopidy.
core.
CoreListenermethod),172TracklistController(classinmopidy.
core),160tracks(mopidy.
models.
Playlistattribute),155tracks(mopidy.
models.
SearchResultattribute),157translate_uri()(mopidy.
backend.
PlaybackProvidermethod),176trigger_mute_changed()(mopidy.
mixer.
Mixermethod),191trigger_volume_changed()(mopidy.
mixer.
Mixermethod),191type(mopidy.
models.
Refattribute),153Uunpublish()(mopidy.
zeroconf.
Zeroconfmethod),197URI(classinmopidy.
models.
elds),158uri(mopidy.
models.
Albumattribute),155uri(mopidy.
models.
Artistattribute),155uri(mopidy.
models.
Imageattribute),156uri(mopidy.
models.
Playlistattribute),156uri(mopidy.
models.
Refattribute),153uri(mopidy.
models.
SearchResultattribute),157uri(mopidy.
models.
Trackattribute),154uri_schemes(mopidy.
backend.
Backendattribute),174Vvalidate_choice()(inmodulemopidy.
cong.
validators),196validate_environment()(mopidy.
ext.
Extensionmethod),180validate_extension_data()(inmodulemopidy.
ext),181validate_maximum()(inmodulemopidy.
cong.
validators),196validate_minimum()(inmodulemopidy.
cong.
validators),196validate_required()(inmodulemopidy.
cong.
validators),196ValidatedImmutableObject(classinmopidy.
models),157version(mopidy.
ext.
Extensionattribute),180volume_changed()(mopidy.
core.
CoreListenermethod),172volume_changed()(mopidy.
mixer.
MixerListenermethod),191Wwait_for_state_change()(mopidy.
audio.
Audiomethod),187width(mopidy.
models.
Imageattribute),156ZZeroconf(classinmopidy.
zeroconf),197216Index
搬瓦工最近上线了一个新的荷兰机房,荷兰 EUNL_9 机房,这个 9 的编号感觉也挺随性的,之前的荷兰机房编号是 EUNL_3。这次荷兰新机房 EUNL_9 采用联通 AS9929 高端路线,三网都接入了 AS9929,对于联通用户来说是个好消息,又多了一个选择。对于其他用户可能还是 CN2 GIA 机房更合适一些。其实对于联通用户,这个荷兰机房也是比较远的,相比之下日本软银 JPOS_1 机房可...
昔日数据怎么样?昔日数据新上了湖北十堰云服务器,湖北十堰市IDC数据中心 母鸡采用e5 2651v2 SSD MLC企业硬盘 rdid5阵列为数据护航 100G高防 超出防御峰值空路由2小时 不限制流量。目前,国内湖北十堰云服务器,首月6折火热销售限量30台价格低至22元/月。(注意:之前有个xrhost.cn也叫昔日数据,已经打不开了,一看网站LOGO和名称为同一家,有一定风险,所以尽量不要选择...
简介酷盾安全怎么样?酷盾安全,隶属于云南酷番云计算有限公司,主要提供高防CDN服务,高防服务器等,分为中国境内CDN,和境外CDN和二个产品,均支持SSL。目前CDN处于内测阶段,目前是免费的,套餐包0.01一个。3G流量(高防CDN)用完了继续续费或者购买升级包即可。有兴趣的可以看看,需要实名的。官方网站: :点击进入官网云南酷番云计算有限公司优惠方案流量3G,用完了不够再次购买或者升级套餐流量...
sources.list为你推荐
操作http人人视频总部基地落户重庆重庆影视公司怎么选择?申请支付宝账户如何申请支付宝账户360防火墙在哪里360防火墙三友网三友联众集团怎么样?温州商标注册温州注册商标需要注册公司吗tumblr上不去为什么,爱看软件打不开?页面一直在加载电子商务世界世界前十大电子商务企业名字discuz伪静态Discuz! X3.0 到底能不能伪静态?门户怎么伪静态?站点管理有关站点的知识介绍?
过期域名抢注 荣耀欧洲 vps.net inmotionhosting 全球付 国外idc 10t等于多少g 名片模板psd 服务器怎么绑定域名 web服务器架设软件 京东商城双十一活动 免费mysql 服务器维护方案 qq对话框 万网空间管理 smtp服务器地址 东莞服务器托管 中国联通宽带测试 域名商城 neobux 更多