Add support for country network image files to the Show List view.

This commit is contained in:
JackDandy 2015-05-03 23:52:03 +01:00
parent edd3e90482
commit cab3b43903
4 changed files with 26 additions and 20 deletions

View file

@ -28,6 +28,7 @@
* Add custom show lists to home page
* Change travis to new container builds for faster unit testing
* Add handling for shows that do not have a total number of episodes
* Add support for country network image files to the Show List view
* Change values used for date sorting on home page and episode view for improved compatibility with posix systems

View file

@ -1726,7 +1726,7 @@ h2.day, h2.network{
float:left;
line-height:1.4em;
font-size:1.4em;
text-shadow:-1px -1px 0 #FFF)
text-shadow:-1px -1px 0 #FFF
}
.tvshowTitleIcons{

View file

@ -357,15 +357,12 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name))
</td>
<td class="show-table">
#if $layout != 'simple':
#if $curShow.network:
<img class="show-network-image" src="$sbRoot/images/network/${curShow.network.replace(u"\u00C9",'e').lower()}.png" alt="$curShow.network" title="$curShow.network" />
#else:
<img class="show-network-image" src="$sbRoot/images/network/nonetwork.png" alt="No Network" title="No Network" />
#end if
#else:
$curShow.network
#end if
#if 'simple' != $layout:
#set $img_text = ($curShow.network, 'No Network')[None is $curShow.network]
<img class="show-network-image" src="$sbRoot/images/network/$network_images[$curShow.indexerid]" alt="#echo '%s" title="%s' % ($img_text, $img_text)#" />
#else:
$curShow.network
#end if
</td>
<td class="show-table">
@ -513,14 +510,11 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name))
<td class="tvShow"><a href="$sbRoot/home/displayShow?show=$curShow.indexerid">$curShow.name</a></td>
#end if
#if $layout != 'simple':
#if 'simple' != $layout:
#set $img_text = ($curShow.network, 'No Network')[None is $curShow.network]
<td align="center">
#if $curShow.network:
<span style="display: none;">$curShow.network</span>
<img id="network" width="54" height="27" src="$sbRoot/images/network/${curShow.network.replace(u"\u00C9",'e').lower()}.png" alt="$curShow.network" title="$curShow.network" />
#else:
<img id="network" width="54" height="27" src="$sbRoot/images/network/nonetwork.png" alt="No Network" title="No Network" />
#end if
<img width="54" height="27" src="$sbRoot/images/network/$network_images[$curShow.indexerid]" alt="#echo '%s" title="%s' % ($img_text, $img_text)#" />
</td>
#else:
<td>

View file

@ -497,10 +497,6 @@ class MainHandler(WebHandler):
else:
t.layout = sickbeard.EPISODE_VIEW_LAYOUT
# network countries
cache_db = db.DBConnection('cache.db')
t.country_results = ['(%s)' % x['tvrage_country'] for x in cache_db.select('SELECT distinct(tvrage_country) FROM [network_conversions] where tvdb_network like "%(" || tvrage_country || ")" order by tvrage_country')]
return t.respond()
def _genericMessage(self, subject, message):
@ -596,6 +592,21 @@ class Home(MainHandler):
else:
t.showlists.append(['container%s' % index, 'Show List', sickbeard.showList])
if 'simple' != sickbeard.HOME_LAYOUT:
t.network_images = {}
networks = {}
images_path = ek.ek(os.path.join, sickbeard.PROG_DIR, 'gui', 'slick', 'images', 'network')
for item in sickbeard.showList:
network_name = 'nonetwork' if None is item.network else item.network.replace(u'\u00C9', 'e').lower()
if network_name not in networks:
filename = u'%s.png' % network_name
if not ek.ek(os.path.isfile, ek.ek(os.path.join, images_path, filename)):
filename = u'%s.png' % re.sub(r'(?m)(.*)\s+\(\w{2}\)$', r'\1', network_name)
if not ek.ek(os.path.isfile, ek.ek(os.path.join, images_path, filename)):
filename = u'nonetwork.png'
networks.setdefault(network_name, filename)
t.network_images.setdefault(item.indexerid, networks[network_name])
t.submenu = self.HomeMenu()
t.layout = sickbeard.HOME_LAYOUT