Author: rshortt
Date: Mon Mar 13 17:23:02 2006
New Revision: 1286
Modified:
trunk/WIP/epg2/src/channel.py
trunk/WIP/epg2/src/client.py
trunk/WIP/epg2/src/server.py
trunk/WIP/epg2/src/source_vdr.py
trunk/WIP/epg2/src/source_xmltv.py
trunk/WIP/epg2/src/source_zap2it.py
Log:
Change short_name to name for simplicity.
Modified: trunk/WIP/epg2/src/channel.py
==============================================================================
--- trunk/WIP/epg2/src/channel.py (original)
+++ trunk/WIP/epg2/src/channel.py Mon Mar 13 17:23:02 2006
@@ -2,14 +2,14 @@
import weakref, time
class Channel(object):
- def __init__(self, tuner_id, short_name, long_name, epg):
+ def __init__(self, tuner_id, name, long_name, epg):
self.db_id = None
self.tuner_id = tuner_id
- self.short_name = short_name
+ self.name = name
self.long_name = long_name
# kludge - remove
- self.id = short_name
+ self.id = name
if epg:
self._epg = weakref.ref(epg)
Modified: trunk/WIP/epg2/src/client.py
==============================================================================
--- trunk/WIP/epg2/src/client.py (original)
+++ trunk/WIP/epg2/src/client.py Mon Mar 13 17:23:02 2006
@@ -41,18 +41,18 @@
self._channels_by_tuner_id = {}
self._channels_list = []
data = self._server.query(type="channel", __ipc_noproxy_result = True)
- for row in db.iter_raw_data(data, ("id", "tuner_id", "short_name",
"long_name")):
- db_id, tuner_id, short_name, long_name = row
- chan = Channel(tuner_id, short_name, long_name, self)
+ for row in db.iter_raw_data(data, ("id", "tuner_id", "name",
"long_name")):
+ db_id, tuner_id, name, long_name = row
+ chan = Channel(tuner_id, name, long_name, self)
chan.db_id = db_id
- self._channels_by_name[short_name] = chan
+ self._channels_by_name[name] = chan
self._channels_by_db_id[db_id] = chan
for t in tuner_id:
if self._channels_by_tuner_id.has_key(t):
log.warning('loading channel %s with tuner_id %s '+\
'allready claimed by channel %s',
- chan.short_name, t,
- self._channels_by_tuner_id[t].short_name)
+ chan.name, t,
+ self._channels_by_tuner_id[t].name)
else:
self._channels_by_tuner_id[t] = chan
self._channels_list.append(chan)
@@ -104,7 +104,7 @@
return self._program_rows_to_objects(data)
- def new_channel(self, tuner_id=None, short_name=None, long_name=None):
+ def new_channel(self, tuner_id=None, name=None, long_name=None):
"""
Returns a channel object that is not associated with the EPG.
This is useful for clients that have channels that do not appear
@@ -112,31 +112,31 @@
"""
# require at least one field
- if not tuner_id and not short_name and not long_name:
+ if not tuner_id and not name and not long_name:
log.error('need at least one field to create a channel')
return None
- if not short_name:
+ if not name:
# then there must be one of the others
if tuner_id:
- short_name = tuner_id[0]
+ name = tuner_id[0]
else:
- short_name = long_name
+ name = long_name
if not long_name:
# then there must be one of the others
- if short_name:
- long_name = short_name
+ if name:
+ long_name = name
elif tuner_id:
long_name = tuner_id[0]
- return Channel(tuner_id, short_name, long_name, epg=None)
+ return Channel(tuner_id, name, long_name, epg=None)
- def get_channel(self, short_name):
- if short_name not in self._channels_by_name:
+ def get_channel(self, name):
+ if name not in self._channels_by_name:
return None
- return self._channels_by_name[short_name]
+ return self._channels_by_name[name]
def get_channel_by_db_id(self, db_id):
if db_id not in self._channels_by_db_id:
Modified: trunk/WIP/epg2/src/server.py
==============================================================================
--- trunk/WIP/epg2/src/server.py (original)
+++ trunk/WIP/epg2/src/server.py Mon Mar 13 17:23:02 2006
@@ -37,7 +37,7 @@
db = Database(dbfile)
db.register_object_type_attrs("channel",
tuner_id = (list, ATTR_SIMPLE),
- short_name = (unicode, ATTR_SEARCHABLE),
+ name = (unicode, ATTR_SEARCHABLE),
long_name = (unicode, ATTR_SEARCHABLE),
)
db.register_object_type_attrs("program",
@@ -100,7 +100,7 @@
if t in self._tuner_ids:
log.warning('loading channel %s with tuner_id %s '+\
'allready claimed by another channel',
- c["short_name"], t)
+ c["name"], t)
else:
self._tuner_ids.append(t)
@@ -161,9 +161,9 @@
self._channel_id_to_db_id = {}
- def _add_channel_to_db(self, tuner_id, short_name, long_name):
+ def _add_channel_to_db(self, tuner_id, name, long_name):
"""
- This method requires at least one of tuner_id, short_name, long_name.
+ This method requires at least one of tuner_id, name, long_name.
Depending on the source (various XMLTV sources, Zap2it, etc.) not all
of the information we would like is available. Also, channels are
perceived differently around the world and handled differently by
@@ -172,10 +172,10 @@
Following the KISS philosophy (Keep It Simple Stupid) we can follow
some
simple rules.
- The most important field here is short_name. If there's no short_name
+ The most important field here is name. If there's no name
we make it based on tuner_id or long_name. If there's no long_name we
- base that on short_name or tuner_id. If there's no tuner_id it does
- not matter because we will then always have a value for short_name.
+ base that on name or tuner_id. If there's no tuner_id it does
+ not matter because we will then always have a value for name.
If there is a tuner_id then it will assist programs using kaa.epg to
match real channels and EPG data.
"""
@@ -184,29 +184,29 @@
tuner_id = [ tuner_id ]
# require at least one field
- if not tuner_id and not short_name and not long_name:
+ if not tuner_id and not name and not long_name:
log.error('need at least one field to add a channel')
return None
- if not short_name:
+ if not name:
# then there must be one of the others
if tuner_id:
- short_name = tuner_id[0]
+ name = tuner_id[0]
else:
- short_name = long_name
+ name = long_name
if not long_name:
# then there must be one of the others
- if short_name:
- long_name = short_name
+ if name:
+ long_name = name
elif tuner_id:
long_name = tuner_id[0]
if not tuner_id:
- tuner_id = [ short_name ]
+ tuner_id = [ name ]
- c2 = self._db.query(type = "channel", short_name = short_name)
+ c2 = self._db.query(type = "channel", name = name)
if len(c2):
c2 = c2[0]
@@ -214,7 +214,7 @@
if t not in c2["tuner_id"]:
if t in self._tuner_ids:
log.warning('not adding tuner_id %s for channel %s -
'+\
- 'it is claimed by another channel', t, short_name)
+ 'it is claimed by another channel', t, name)
else:
# only add this id if it's not already there and not
# claimed by another channel
@@ -230,14 +230,14 @@
for t in tuner_id:
if t in self._tuner_ids:
log.warning('not adding tuner_id %s for channel %s - it is '+\
- 'claimed by another channel', t, short_name)
+ 'claimed by another channel', t, name)
tuner_id.remove(t)
else:
self._tuner_ids.append(t)
o = self._db.add_object("channel",
tuner_id = tuner_id,
- short_name = short_name,
+ name = name,
long_name = long_name)
return o["id"]
Modified: trunk/WIP/epg2/src/source_vdr.py
==============================================================================
--- trunk/WIP/epg2/src/source_vdr.py (original)
+++ trunk/WIP/epg2/src/source_vdr.py Mon Mar 13 17:23:02 2006
@@ -124,7 +124,7 @@
log.info('Adding channel: %s as %s' % (c.id, access_id))
chan_db_id =
info.epg._add_channel_to_db(tuner_id=strutils.str_to_unicode(access_id),
-
short_name=strutils.str_to_unicode(c.name),
+
name=strutils.str_to_unicode(c.name),
long_name=None)
for e in c.events:
Modified: trunk/WIP/epg2/src/source_xmltv.py
==============================================================================
--- trunk/WIP/epg2/src/source_xmltv.py (original)
+++ trunk/WIP/epg2/src/source_xmltv.py Mon Mar 13 17:23:02 2006
@@ -82,7 +82,7 @@
# for the used grabber somehow.
name = display or station
- db_id = info.epg._add_channel_to_db(tuner_id=channel, short_name=station,
long_name=name)
+ db_id = info.epg._add_channel_to_db(tuner_id=channel, name=station,
long_name=name)
info.channel_id_to_db_id[channel_id] = [db_id, None]
Modified: trunk/WIP/epg2/src/source_zap2it.py
==============================================================================
--- trunk/WIP/epg2/src/source_zap2it.py (original)
+++ trunk/WIP/epg2/src/source_zap2it.py Mon Mar 13 17:23:02 2006
@@ -131,7 +131,7 @@
channel = int(node.prop("channel"))
db_id = info.epg._add_channel_to_db(tuner_id=channel,
-
short_name=info.stations_by_id[id]["station"],
+
name=info.stations_by_id[id]["station"],
long_name=info.stations_by_id[id]["name"])
info.stations_by_id[id]["db_id"] = db_id
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog