Kodi Community Forum
Linux set custom category for path - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: Linux set custom category for path (/showthread.php?tid=127703)



set custom category for path - zosky - 2012-04-04

hi yall.

i have a ton of "hollywood" TV, documentories, anime & home movies in my library... my TV list ends up being MASSIVE, & useless. i found a way around this using a combination of smartPlaylists & categories... this bash script exports a list of all shows that have "anime" in the path & all shows in the anime category ... the difference (anime without the anime category) is updated

are there other (better) solutions to do this ?
xwmm is amazing for editing single items
(it does not do anything in bulk)

maybe this will tickle some1 (smarter then i)
and we can see this in an add-on ?

cheers
~ z

Code:
#/bin/bash
# xbmc anime catogrizer

mysqlCMD="-uxbmc -pxbmc xbmcvid60"

## list all anime in anime DIR by showID
ALL=$(mysql -e "SELECT tvshowlinkpath.idShow
      FROM path, tvshowlinkpath, tvshow
      WHERE path.strPath LIKE \"%anime%\"
      AND tvshowlinkpath.idPath = path.idPath
      AND tvshow.idShow = tvshowlinkpath.idShow" $mysqlCMD|sort )

## list all anime in anime CAT by showID
ANI=$(mysql -e "SELECT idShow
        FROM genrelinktvshow WHERE idGenre = 57" $mysqlCMD|sort )

## COMMpare both lists & output NEW
# (unique to file1 / ALL w/o CAT=Anime)
NEW=$(comm -23 <(echo "$ALL") <(echo "$ANI"))

## IF SOMETHING IS NEW ... UPDATE THE DB
[[ "$NEW" ]] && {
      for newID in $NEW; do
      mysql -e "INSERT INTO genrelinktvshow (idGenre, idShow)
            VALUES (\"57\", \"$newID\")" $mysqlCMD
      done
      echo "set CAT anime for $(echo "$NEW"|wc -l) new shows"
    }



RE: set custom category for path - DaMizZa - 2012-04-04

There is... I just set it up the other day and so far it's working beautifully. Check out this thread for a well-written up tutorial on the topic:

http://forum.xbmc.org/showthread.php?tid=89678