# Playing files from HTML server

**URL:** <https://forums.plex.tv/t/playing-files-from-html-server/52849>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [January 5, 2014, 5:33pm UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849 "2014-01-05T17:33:56Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![ma\_rvin](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@ma\_rvin](https://forums.plex.tv/u/ma_rvin)\
**Post date:** [January 5, 2014, 5:33pm UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849/1 "2014-01-05T17:33:56Z")

</div>

Hi,

&nbsp;

I've been reading into developing a simple plugin for plex and I can't really get started.

The few examples and tutorials I've found didn't really help me much.

&nbsp;

What I want is a plugin which reads a HTML directory and can play all the files (all are mp4 coded) found there. Could someone please point me to a simple example where I can see how this would be done?

&nbsp;

Getting metadata information, menu hierachy and such can be done later. For now I just want to play files from a html server.

&nbsp;

&nbsp;

As I understand do I need to define a URLService in the Info.plist.

I don't really see where this service is used in the \_\_init\_\_.py.

&nbsp;

In the&nbsp;\_\_init\_\_.py all magic happens: the menus get created and filled with the links to the video files.

Is that correct? I'd be glad for any help and am sorry if I missed somethign curcial in the documentation.

&nbsp;

---

<div class="post-metadata">

**Author:** ![mikedm139](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/mikedm139/32/96909_2.png) [@mikedm139](https://forums.plex.tv/u/mikedm139)\
**Post date:** [January 5, 2014, 8:13pm UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849/2 "2014-01-05T20:13:33Z")

</div>

If all the files are presented on one page, then an url service is not the best approach. If the files are contained within separate sub-directories, then an url service could prove quite useful. Probably best if you include some sample HTML, either real or made-up but representative.

---

<div class="post-metadata">

**Author:** ![ma\_rvin](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@ma\_rvin](https://forums.plex.tv/u/ma_rvin)\
**Post date:** [January 5, 2014, 8:20pm UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849/3 "2014-01-05T20:20:13Z")

</div>

Update:

The problem is now that the URL service is not found.

```
DEBUG (services:602) - No service found for URL [...]
DEBUG (services:617) - No matching services found for [...]
```

here's what I have so far:

Files:

/Contents/info.plist; DefaultPrefs.json

&nbsp; &nbsp;/Code/\_\_init\_\_.py

&nbsp; &nbsp;/URL Services/30C3/ServiceCode.pys

&nbsp; &nbsp;/Resources/art-default.jpg; icon-default.jpg

Code:

see files, here just the url service stuff.

Info.plist

```
[...]
PlexURLServices

   30C3
   
      URLPattern
      http://(.*)/congress/2013/mp4/
      Identifier
      com.plexapp.plugins.30c3-mp4
      TestURLs
      
        http://cdn.media.ccc.de/congress/2013/mp4/30c3-5185-en-FPGA_101_h264-hq.mp4
        http://141.70.0.13/congress/2013/mp4/30c3-5290-en-Console_Hacking_2013_h264-hq.mp4
     
   

[...]
```

ServiceCode.pys

```
def MetadataObjectForURL(url):
 
   page = HTML.ElementFromURL(url)
 
   return VideoClipObject(
      title = 'title',
      summary = 'description'
   )
 
def MediaObjectsForURL(url):
   return [
      MediaObject(
         video_codec = VideoCodec.H264,
         audio_codec = AudioCodec.AAC,
         video_resolution = '720',
         audio_channels = 2,
         container = 'mp4',
      )
   ]
```

any hints are greatly appreciated

---

<div class="post-metadata">

**Author:** ![ma\_rvin](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@ma\_rvin](https://forums.plex.tv/u/ma_rvin)\
**Post date:** [January 5, 2014, 8:23pm UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849/4 "2014-01-05T20:23:09Z")

</div>

The files do lie in a flat directory. how could this be done without an url service?

in future i might want to add other directories of that server. would it be helpful to use url services for that?

---

<div class="post-metadata">

**Author:** ![shopgirl284](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@shopgirl284](https://forums.plex.tv/u/shopgirl284)\
**Post date:** [January 5, 2014, 8:40pm UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849/5 "2014-01-05T20:40:53Z")

</div>

You have to create a ServiceInfo.plist that tells it to look for the URL Service named 30C3 and give it the pattern of the URLs that will be passed to it.&nbsp;

You are using the Info.plist but that should just be for the basics about your channel and the clients it supports. The Framework Documentation is out of date in this area. It is noted here in the this pinned Missing From Framework document -&nbsp;[https://forums.plex.tv/topic/87324-missing-from-the-official-plugin-documentation/](https://forums.plex.tv/topic/87324-missing-from-the-official-plugin-documentation/)&nbsp;(click the link to see the full document)

Here is a template for the ServiceInfo.plist -&nbsp;[https://forums.plex.tv/topic/62610-channel-development-templates/?p=393464](https://forums.plex.tv/topic/62610-channel-development-templates/?p=393464). That page also has an Info.plist with all the current options for it as well.

The file folder structure is a little off too. Instead of URLService, it should be called Services and contain a folder called URL that contains the ServiceInfo.plist and the folder called 30C3.

---

<div class="post-metadata">

**Author:** ![shopgirl284](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@shopgirl284](https://forums.plex.tv/u/shopgirl284)\
**Post date:** [January 5, 2014, 8:50pm UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849/6 "2014-01-05T20:50:15Z")

</div>

Here is link to an example of a channel that still has a URL service directly connected to it. It may not be that similar to your particular projec, but it does show you the file folder structure and the basic structure of the files themselves.

[https://github.com/meriko/LinkTV.bundle](https://github.com/meriko/LinkTV.bundle)

---

<div class="post-metadata">

**Author:** ![ma\_rvin](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@ma\_rvin](https://forums.plex.tv/u/ma_rvin)\
**Post date:** [January 5, 2014, 9:00pm UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849/7 "2014-01-05T21:00:10Z")

</div>

thanks a lot .. i'll look into it

---

<div class="post-metadata">

**Author:** ![ma\_rvin](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@ma\_rvin](https://forums.plex.tv/u/ma_rvin)\
**Post date:** [January 8, 2014, 9:44pm UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849/8 "2014-01-08T21:44:01Z")

</div>

i've fixed the folder structure and this should be correct now.

also did i create a ServiceInfo.plist but i still get the "No service found for URL" error.

could it be that my example is just too basic and the i miss to set some reference or the like?

---

<div class="post-metadata">

**Author:** ![shopgirl284](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@shopgirl284](https://forums.plex.tv/u/shopgirl284)\
**Post date:** [January 8, 2014, 10:30pm UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849/9 "2014-01-08T22:30:31Z")

</div>

Usually if it says it cannot find a URL service once you have all the files and folders in place, then either you haven't rebooted Plex so it will recognize your plugin properly or the regex you used for your URL pattern is not correct, so Plex is unable to find a Service with a pattern that matches the URL you are trying to process.

---

<div class="post-metadata">

**Author:** ![ma\_rvin](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@ma\_rvin](https://forums.plex.tv/u/ma_rvin)\
**Post date:** [January 8, 2014, 10:56pm UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849/10 "2014-01-08T22:56:15Z")

</div>

it was indeed the regex. my guess was that i only needed to specify the domain, but the entire link is needed.

now i'm on to the next error ;)

"Error when attempting to normalize URL '[http://141.70.0.13/congress/2013/mp4/30c3-5185-en-FPGA\_101\_h264-hq.mp4](http://141.70.0.13/congress/2013/mp4/30c3-5185-en-FPGA_101_h264-hq.mp4)' (most recent call last):"

with

```
def NormalizeURL(url):
    return url
```

(yes, it doesn't do anything. but it should work, shouldn't it)

i'll try to figure sth out

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [January 8, 2014, 11:36pm UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849/11 "2014-01-08T23:36:34Z")

</div>

A URL Service is used to transform a non-video URL into a metadata object and a media object.

```
IN: OUT:
http://www.example.com/unique_url.html ---> URL Service ---> [metadata] title/summary/thumbnail/etc.
                                                        ---> [media] container/video codec/audio codec/resolution/etc.
```

A URL Service cannot work with a list of videos all on one page (because the input URL is not unique for 1 video). But a channel/plugin can work without a URL Service. Attached to this post is an example of how this CCC channel could work.

**Edit:** There's a bug in the Plex for Home Theater client where the details screen (the screen you see before you play a video) is blank if we're not using a URL Service.

---

<div class="post-metadata">

**Author:** ![ma\_rvin](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@ma\_rvin](https://forums.plex.tv/u/ma_rvin)\
**Post date:** [January 8, 2014, 11:52pm UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849/12 "2014-01-08T23:52:22Z")

</div>

wooo ... i'm flashed .. copy, past, works. great! thanks!

now i'll start parsing metadata and organising that stuff.

so i don't need services after all. the documentation seem a little confusing to me :/

---

<div class="post-metadata">

**Author:** ![ma\_rvin](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@ma\_rvin](https://forums.plex.tv/u/ma_rvin)\
**Post date:** [January 9, 2014, 12:50am UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849/13 "2014-01-09T00:50:39Z")

</div>

thanks for the edit.

i'll target the webclient / xml output right now. but it's good to know.

would u care if i put your code with my changes/additions into a public git?

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [January 9, 2014, 1:07am UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849/14 "2014-01-09T01:07:44Z")

</div>

> thanks for the edit.
> 
> i'll target the webclient / xml output right now. but it's good to know.
> 
> would u care if i put your code with my changes/additions into a public git?

Hi! No problem, go ahead :)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 21, 2019, 12:56am UTC](https://forums.plex.tv/t/playing-files-from-html-server/52849/17 "2019-12-21T00:56:05Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
