Import script for movies and tveps

MirtheN
2008-04-29
2013-05-30
  • MirtheN

    MirtheN - 2008-04-29

    just sharing this incase any one else wants it. i used the sample script for doing imports using folders as containers, but ran into an issue with my TVEps folder. i used for example /media/tveps/someshow/1/ for sorting my tveps on my drives, so when i used the import script provided on the site it would use /someshow/1 and skip out the /tveps part. so this lil modified bit will let you use both folder types for movies and tveps so everything is still contained right....

    function addVideo(obj)
    {
            var chain, show, season;
            var location = obj.location.split('/');
            chain = new Array();
        if (location[location.length-4] == 'TVEps')
        {
           
            chain.push(location[location.length-4]); //genre name  (Movies, TVShows, etc)
                chain.push(location[location.length-3]); //series/movie name (Movie1, TVShow1,)
            chain.push(location[location.length-2]);
        }
        else
        {
                chain.push(location[location.length-3]); //genre name  (Movies, TVShows, etc)
                chain.push(location[location.length-2]); //series/movie name (Movie1, TVShow1,)
        }
            addCdsObject(obj, createContainerChain(chain));
    }

     
    • Jin

      Jin - 2008-05-01

      Thanks! Actually that would have been something for the wiki ;)

       
    • Maurice118

      Maurice118 - 2008-05-26

      I was more thinking of this where "Videos" is your parent dir for all your videos.
      The advantage is that you can make more subdirectories without changing the script.
      BTW I didn't tested it yet.
      If I have my script for the photos ready I will also implement this and post it on the wiki. 

      function addVideo(obj)
      {

      var location = obj.location.split('/');
      chain = new Array();
      var dirList=new Array();
      var j=0;
      for (i=location.length-2;i>=0;i--)
      {
          dirList[j]=location[i];   
          if (location[i]!='Videos') {j++;continue;}
         
      }
      for (i=0;i<=j;i++)
      {
          chain.push(dirList[i]);
      }   

      addCdsObject(obj, createContainerChain(chain));
      }

      Maurice

       
    • Maurice118

      Maurice118 - 2008-05-26

      To quick to press the post Comment button :)
      This should work better.

      function addVideo(obj)
      {

      var location = obj.location.split('/');
      chain = new Array();
      var dirList=new Array();
      var j=0;
      for (i=location.length-2;i>=0;i--)
      {
          dirList[j]=location[i];   
          if (location[i]=='Videos') {break;}
          j++;
         
      }
      for (i=0;i<=j;i++)
      {
          chain.push(dirList[i]);
      }   

      addCdsObject(obj, createContainerChain(chain));
      }

       
    • Maurice118

      Maurice118 - 2008-05-26

      Oops I was pushing the wrong way :)
      Below works and is tested.

      function addVideo(obj)
      {

      var location = obj.location.split('/');
      chain = new Array();
      var dirList=new Array();
      var j=0;
      for (i=location.length-2;i>=0;i--)
      {
          dirList[j]=location[i];   
          if (location[i]=='Videos') {break;}
          j++;
         
      }
      for (i=j;i>=0;i--)
      {
          chain.push(dirList[i]);
      }   

      addCdsObject(obj, createContainerChain(chain));
      }

      Maurice

       
    • Kent

      Kent - 2008-05-27

      Hi.

      I recently got my ps3, when i use mediatomb and the script Maurice posted it works perfectly under

      Koseboks (My servername)
      -> Media
      -->Disk
      --->Serier (Tvshows)
      ----> Subdirectories

      But under my "Video" folder it comes

      -> Video
      Alot of filenames, not any subdirectories, can this be fixed in any way?

       
    • Maurice118

      Maurice118 - 2008-05-28

      You probably tried the script in my first post in this thread, but I posted it before testing stupid mistake, because you can't edit your posts here.
      The following script I have tested and it works. If you have a different parent directory then Videos, be sure to change that in the script in the following line --if (location[i]=='Videos') {break;}-- 

      function addVideo(obj) 

      var location = obj.location.split('/'); 
      chain = new Array(); 
      var dirList=new Array();
      var j=0;
      for (i=location.length-2;i>=0;i--)
      {
      dirList[j]=location[i]; 
      if (location[i]=='Videos') {break;}
      j++;

      }
      for (i=j;i>=0;i--)
      {
      chain.push(dirList[i]);

      addCdsObject(obj, createContainerChain(chain)); 
      }

      Maurice

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks