--- a/update-hib.py Wed Dec 12 22:48:14 2012 -0500
+++ b/update-hib.py Sun Mar 17 22:09:01 2013 -0400
@@ -7,7 +7,7 @@
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 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
@@ -197,7 +197,7 @@
return res
def __repr__(self):
return self.format()
-
+
class Game:
def __init__(self, dom):
self.title = "unknown"
@@ -239,18 +239,20 @@
for game in parseGamesFromDom(parser.dom):
yield game
-class FileSelector:
+class FileSelector:
def scoreDownload(self, dl):
if dl.dltype == "audio":
+ if not dl.attrs: # Empty set, so we simply take it.
+ return 1
if "FLAC" in dl.attrs:
return 1
if "OGG" in dl.attrs:
- return 1
+ return 1
if "MP3" in dl.attrs:
- return 1
+ return 1
if "website" in dl.attrs:
return -1
- raise Exception("Unknow audio type: %r" % (dl.attrs))
+ raise Exception("Unknown audio type: %r" % (dl.attrs))
if dl.dltype in ("mac","windows"):
return -1
if dl.dltype == "linux":
@@ -259,6 +261,8 @@
score += 2
if "deb" in dl.attrs:
score += 1
+ if "Stream" in dl.attrs:
+ score -= 1
return score
if dl.dltype == "android":
return -1
@@ -298,7 +302,7 @@
print("[%s] %2d | %-20s | %-10s | %-25s | %s " % (
"*" if dl in choosen else " ",
score,
- game.title,
+ game.title,
dls.id,
", ".join(sorted(dl.attrs)),
dl.torrent))
@@ -329,8 +333,8 @@
else:
logging.info("No torrent, url is %s", dl.web)
fn = os.path.basename(urllib.parse.urlsplit(dl.web).path)
- urlfile.write("wget --progress=bar -c -O ../packages/%s \"%s\"\n" % (fn,dl.web))
-
+ urlfile.write("wget --progress=bar -c -O %s \"%s\"\n" % (fn,dl.web))
+
if __name__ == '__main__':