# DVD Order Agent

**URL:** <https://forums.plex.tv/t/dvd-order-agent/6793>\
**Category:** Dev/API Corner\
**Tags:** scanner-agent-dev\
**Created:** [December 5, 2010, 9:20pm UTC](https://forums.plex.tv/t/dvd-order-agent/6793 "2010-12-05T21:20:27Z")\
**Posts on this page:** 1\
**Showing post:** 324

<div class="post-metadata">

**Author:** ![gitchownd](https://avatars.discourse-cdn.com/v4/letter/g/bcef8e/32.png) [@gitchownd](https://forums.plex.tv/u/gitchownd)\
**Post date:** [May 18, 2015, 7:56am UTC](https://forums.plex.tv/t/dvd-order-agent/6793/324 "2015-05-18T07:56:23Z")

</div>

Just installed this today to fix my Firefly. The order's fine now but the theme music's gone. I've gone over all my settings and everything that needs to be checked is checked. I've unmatched and rematched several times, but no luck. When I go back to the default agent, the theme music works again. Any suggestions? I'm running my server on win 8.1.  
  
Edit:  
  
Nevermind! Figured it out. Did not see the bit about editing PlexThemeMusic.bundle's \_\_init\_\_.py earlier. The last mention of having to do this was quite a while ago, and the file has changed a bit since. I know others have had this issue and not everyone knows Python, so I've copied the contents of my \_\_init\_\_.py here. Just open /PlexThemeMusic.bundle/Contents/Code/\_\_init\_\_.py and replace the contents with the code below, restart your server, and rematch/refresh the show you're matching with this agent, and the theme music should work properly. PMS seems to rewrite this file quite regularly with the original, so marking it read-only wouldn't hurt.

```
#Plex Theme Music
THEME_URL = 'http://tvthemes.plexapp.com/%s.mp3'

def Start():  
HTTP.CacheTime = CACHE\_1DAY

class PlexThemeMusicAgent(Agent.TV\_Shows):  
name = ‘Plex Theme Music’  
languages = [Locale.Language.NoLanguage]  
primary\_provider = False  
contributes\_to = [  
‘com.plexapp.agents.thetvdb’,  
‘com.plexapp.agents.thetvdbdvdorder’,  
‘com.plexapp.agents.themoviedb’  
]

def search(self, results, media, lang):

```
if media.primary_agent == 'com.plexapp.agents.thetvdb' or media.primary_agent == 'com.plexapp.agents.thetvdbdvdorder':
  results.Append(MetadataSearchResult(
    id = media.primary_metadata.id,
    score = 100
  ))

elif media.primary_agent == 'com.plexapp.agents.themoviedb':
  # Get the TVDB id from the Movie Database Agent
  tvdb_id = Core.messaging.call_external_function(
    'com.plexapp.agents.themoviedb',
    'MessageKit:GetTvdbId',
    kwargs = dict(
      tmdb_id = media.primary_metadata.id
    )
  )

  if tvdb_id:
    results.Append(MetadataSearchResult(
      id = tvdb_id,
      score = 100
    ))

```

def update(self, metadata, media, lang):  
if THEME\_URL % metadata.id not in metadata.themes:  
try:  
metadata.themes[THEME\_URL % metadata.id] = Proxy.Media(HTTP.Request(THEME\_URL % metadata.id))  
except:  
pass
```

---

_[View the full topic](https://forums.plex.tv/t/dvd-order-agent/6793)._
