podcastChannel now acts like a list (Thanks to Adrien Beaucreux)
git-svn-id: svn://svn.berlios.de/gpodder@85 b0d088ad-0a06-0410-aad2-9ed5178a7e87
This commit is contained in:
parent
f6d1d28dec
commit
2f71ac04b5
|
@ -5,6 +5,10 @@ Sat, 08 Apr 2006 08:44:31 +0200 <thp@perli.net>
|
|||
explicitly called with "make messages" - this should put us in
|
||||
for less useless SVN diffs, as suggested by Alain
|
||||
* Modified "doc/dev/i18n.txt" to reflect changes of today
|
||||
* Applied patch from Adrien Beaucreux to make the podcastChannel
|
||||
class act like a Python list and therefore make code more cute
|
||||
* Modified "data/po/Makefile" and "Makefile" for modifying the
|
||||
*.po files only when explicitly requested by the developer
|
||||
|
||||
Fri, 07 Apr 2006 22:00:06 +0200 <thp@perli.net>
|
||||
* Uhh! Gotta love bureaucracy (bureaucrazy?) -- anyway, got some
|
||||
|
|
4
Makefile
4
Makefile
|
@ -54,6 +54,7 @@ uninstall:
|
|||
##########################################################################
|
||||
|
||||
generators: $(MANPAGE) gen_glade
|
||||
make -C data/po update
|
||||
|
||||
messages: gen_gettext
|
||||
|
||||
|
@ -65,7 +66,8 @@ gen_glade: $(GLADEFILE)
|
|||
chmod -x $(GUIFILE) $(GUIFILE).orig
|
||||
|
||||
gen_gettext: $(MESSAGESPOT)
|
||||
make -C data/po
|
||||
make -C data/po generators
|
||||
make -C data/po update
|
||||
|
||||
$(GLADEGETTEXT): $(GLADEFILE)
|
||||
intltool-extract --type=gettext/glade $(GLADEFILE)
|
||||
|
|
|
@ -1,10 +1,32 @@
|
|||
# gpodder translation makefile
|
||||
#
|
||||
# gPodder (a media aggregator / podcast client)
|
||||
# Copyright (C) 2005-2006 Thomas Perl <thp at perli.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
# MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
default:
|
||||
for langfile in *.po; do echo -n $${langfile}; msgmerge -U $${langfile} ../messages.pot; mkdir -p ../locale/`basename $${langfile} .po`/LC_MESSAGES/; msgfmt $${langfile} -o ../locale/`basename $${langfile} .po`/LC_MESSAGES/gpodder.mo; done
|
||||
update:
|
||||
for langfile in *.po; do echo 'Compiling translation:' $${langfile}; mkdir -p ../locale/`basename $${langfile} .po`/LC_MESSAGES/; msgfmt $${langfile} -o ../locale/`basename $${langfile} .po`/LC_MESSAGES/gpodder.mo; done
|
||||
|
||||
generators:
|
||||
for langfile in *.po; do echo -n $${langfile}; msgmerge -U $${langfile} ../messages.pot; done
|
||||
|
||||
clean:
|
||||
rm -rf ../locale *~ *.mo
|
||||
|
||||
.PHONY: default clean
|
||||
|
||||
.PHONY: update generators clean
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ def run():
|
|||
pool = DownloadPool()
|
||||
|
||||
for channel in updated_channels:
|
||||
for item in channel.items:
|
||||
for item in channel:
|
||||
filename = channel.getPodcastFilename( item.url)
|
||||
if not channel.isDownloaded( item):
|
||||
while not pool.may_download():
|
||||
|
|
|
@ -563,7 +563,7 @@ class Gpodder(SimpleGladeApp):
|
|||
self.active_item = self.channels[self.active_channel].getActiveByUrl( url)
|
||||
|
||||
current_channel = self.channels[self.active_channel]
|
||||
current_podcast = current_channel.items[self.active_item]
|
||||
current_podcast = current_channel[self.active_item]
|
||||
filename = current_channel.getPodcastFilename( current_podcast.url)
|
||||
if widget.get_name() == "treeAvailable":
|
||||
Gpodderepisode().set_episode( current_podcast)
|
||||
|
|
|
@ -165,10 +165,9 @@ class gPodder_iPodSync(object):
|
|||
if not channel.sync_to_devices:
|
||||
# we don't want to sync this..
|
||||
return False
|
||||
items = channel.items
|
||||
max = len(items)
|
||||
max = len( channel)
|
||||
i = 1
|
||||
for episode in items:
|
||||
for episode in channel:
|
||||
if self.callback_progress != None:
|
||||
gobject.idle_add( self.callback_progress, i, max)
|
||||
if channel.isDownloaded( episode):
|
||||
|
|
|
@ -37,7 +37,7 @@ class writeLocalDB( object):
|
|||
ofile = None
|
||||
|
||||
def __init__( self, filename, channel, delete_if_empty = True):
|
||||
if delete_if_empty and len( channel.items) == 0:
|
||||
if delete_if_empty and len( channel) == 0:
|
||||
if libgpodder.isDebugging():
|
||||
print "Seems like there is no item left in this localDB channel"
|
||||
print "Deleting channel index file of empty local channel.."
|
||||
|
@ -56,7 +56,7 @@ class writeLocalDB( object):
|
|||
self.writeLink( channel.link)
|
||||
self.writeMetadata( channel)
|
||||
|
||||
for item in channel.items:
|
||||
for item in channel:
|
||||
self.addItem( item)
|
||||
|
||||
self.close()
|
||||
|
|
|
@ -36,6 +36,8 @@ from os.path import exists
|
|||
from os.path import basename
|
||||
from os.path import splitext
|
||||
|
||||
from types import ListType
|
||||
|
||||
from liblocdbwriter import writeLocalDB
|
||||
from liblocdbreader import readLocalDB
|
||||
|
||||
|
@ -45,14 +47,13 @@ import re
|
|||
|
||||
import md5
|
||||
|
||||
class podcastChannel(object):
|
||||
class podcastChannel(ListType):
|
||||
"""holds data for a complete channel"""
|
||||
def __init__( self, url = "", title = "", link = "", description = ""):
|
||||
self.url = url
|
||||
self.title = title
|
||||
self.link = link
|
||||
self.description = stripHtml( description)
|
||||
self.items = []
|
||||
self.image = None
|
||||
self.shortname = None
|
||||
self.downloaded = None
|
||||
|
@ -82,7 +83,7 @@ class podcastChannel(object):
|
|||
fset=set_filename)
|
||||
|
||||
def addItem( self, item):
|
||||
self.items.append( item)
|
||||
self.append( item)
|
||||
|
||||
def get_localdb_channel( self):
|
||||
ch = None
|
||||
|
@ -142,14 +143,14 @@ class podcastChannel(object):
|
|||
|
||||
already_in_list = False
|
||||
# try to find the new item in the list
|
||||
for it in self.downloaded.items:
|
||||
for it in self.downloaded:
|
||||
if it.equals( item):
|
||||
already_in_list = True
|
||||
break
|
||||
|
||||
# only append if not already in list
|
||||
if not already_in_list:
|
||||
self.downloaded.items.append( item)
|
||||
self.downloaded.append( item)
|
||||
else:
|
||||
if libgpodder.isDebugging():
|
||||
print "no need to re-add already added podcast item to localDB"
|
||||
|
@ -160,7 +161,7 @@ class podcastChannel(object):
|
|||
|
||||
def printChannel( self):
|
||||
print '- Channel: "' + self.title + '"'
|
||||
for item in self.items:
|
||||
for item in self:
|
||||
print '-- Item: "' + item.title + '"'
|
||||
|
||||
def isDownloaded( self, item):
|
||||
|
@ -169,7 +170,7 @@ class podcastChannel(object):
|
|||
def getItemsModel( self, want_color = True):
|
||||
new_model = gtk.ListStore( gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_BOOLEAN, gobject.TYPE_STRING)
|
||||
|
||||
for item in self.items:
|
||||
for item in self:
|
||||
# Skip items with no download url
|
||||
if item.url != "":
|
||||
if self.isDownloaded(item) and want_color:
|
||||
|
@ -188,7 +189,7 @@ class podcastChannel(object):
|
|||
def getActiveByUrl( self, url):
|
||||
i = 0
|
||||
|
||||
for item in self.items:
|
||||
for item in self:
|
||||
if item.url == url:
|
||||
return i
|
||||
i = i + 1
|
||||
|
@ -291,10 +292,10 @@ class podcastChannel(object):
|
|||
locdb_reader = readLocalDB()
|
||||
locdb_reader.parseXML( localdb)
|
||||
self.downloaded = locdb_reader.channel
|
||||
for item in self.downloaded.items:
|
||||
for item in self.downloaded:
|
||||
if item.title == title and item.url == url:
|
||||
nr_items += 1
|
||||
self.downloaded.items.remove(item)
|
||||
self.downloaded.remove(item)
|
||||
except:
|
||||
print _("No LocalDB found or error in existing LocalDB.")
|
||||
if libgpodder.isDebugging():
|
||||
|
|
Loading…
Reference in New Issue