Skip to content

Commit

Permalink
Versión final lista
Browse files Browse the repository at this point in the history
  • Loading branch information
sergioherrera2 committed Jan 28, 2019
1 parent 753c1dc commit b14277f
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ def run(self, argv):
print("[INFO] Especifique la dirección url del vídeo: ")
url = input()
nombre = 'Servidor ' + str(contador)
adapter.activate()
dl = sf.make(nombre)
dl.addDownloadTask(url)
adapter.activate()
topic.unsubscribe(subscriber)
print()
print('\033[36m' + "[INFO] Descarga completada correctamente, puedes encontrar tu canción en el servidor." + '\033[0m')
Expand Down
Binary file added Documentación.pdf
Binary file not shown.
Binary file modified IceStorm/data.mdb
Binary file not shown.
1 change: 1 addition & 0 deletions IceStorm/icedb.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5016
Binary file modified IceStorm/lock.mdb
Binary file not shown.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

all:

clean:
$(RM) *~
$(RM) -r db
Expand All @@ -26,9 +24,13 @@ run-server: icestorm.config
./Server.py --Ice.Config=server.config

run-client: icestorm.config
./Client.py "Downloader1 -t -e 1.1:tcp -h 192.168.1.36 -p 4061 -t 60000" --Ice.Config=client.config
#La ip debe ajustarse a la que corresponda

run-iceclient: icestorm.config
./Client.py --Ice.Config=client.config Downloader1

copy_binaries:
copy-binaries:
mkdir -p /tmp/mansol
cp Server.py /tmp/mansol
cp server.config /tmp/mansol
Expand Down
18 changes: 0 additions & 18 deletions Server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ def make(self, nombre, current = None):
def kill(self, nombre, current = None):
serverid = Ice.stringToIdentity(nombre)
current.adapter.remove(serverid)
"""
def availableSchedulers(self, current = None):
"""


class DownloadSchedulerI(Downloader.DownloadScheduler):
Expand Down Expand Up @@ -76,20 +73,6 @@ def end(self, current=None):
print("[INFO] Solicitud de copia del servidor completada.")
print("\033[1;0m")
print()

#WIP
class SyncEventI(Downloader.SyncEvent):
def __init__(self, canciones):
self.canciones = canciones

def notify(self, cancionesrecibidas, current = None):
print("[INFO] Canciones en el servidor:") #Downloader.SongList
print(cancionesrecibidas)
self.canciones=list(set(self.canciones) | set(cancionesrecibidas))

def requestSync(self, current = None):
print("[INFO] Solicitud de sincronización.")
self.notify(self.canciones)

class Server(Ice.Application):
def get_topic_manager(self):
Expand Down Expand Up @@ -117,7 +100,6 @@ def run(self, argv):

publisher = topic.getPublisher()
progress_topic = Downloader.ProgressEventPrx.uncheckedCast(publisher)
#servant.sync_proxy = Downloader.SyncEventPrx.uncheckedCast(self.get_topic_manager("SyncTopic").subscribeAndGetPublisher({},proxy))

work_queue = WorkQueue(progress_topic)

Expand Down
Binary file modified __pycache__/work_queue.cpython-36.pyc
Binary file not shown.
Binary file removed doc.odt
Binary file not shown.
2 changes: 1 addition & 1 deletion mansol.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
</properties>
<distrib icepatch="${application}.IcePatch2/server"/>
<adapter name="DlAdapter" endpoints="default" id="${server}.DlAdapter">
<object identity="dl1" type="::Downloader::DownloadScheduler"/>
<object identity="Downloader1" type="::Downloader::DownloadScheduler"/>
</adapter>
</server>
</server-template>
Expand Down
9 changes: 4 additions & 5 deletions work_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,10 @@ def progress_hook(status):
options['outtmpl'] = os.path.join(destination, '%(title)s.%(ext)s')

with youtube_dl.YoutubeDL(options) as ydl:
#aquí no tiene que haber un try, está abajo. Comprobar .download(url)
ydl.download([url])
sys.stdout.write("\033[1;36m")
print("[INFO] Descarga completada.")
sys.stdout.write("\033[1;0m")
#sys.stderr.write("\033[1;31m")
#print("[ERROR] Dirección url inválida, no se ha descargado nada.",file=sys.stderr)
#sys.stdout.write("\033[1;0m")

filename = task_status['filename']
# BUG: filename extension is wrong, it must be mp3
Expand All @@ -93,8 +89,11 @@ def run(self):
try:
job.download()
self.ProgressTopic.notify(Downloader.ClipData(job.get_url(), Downloader.Status.DONE))
except Exception as error:
except Exception:
self.ProgressTopic.notify(Downloader.ClipData(job.get_url(), Downloader.Status.ERROR))
#sys.stderr.write("\033[1;31m")
#print("[ERROR] Dirección url inválida, no se ha descargado nada.",file=sys.stderr)
#sys.stdout.write("\033[1;0m")
self.queue.task_done()

self.queue.task_done()
Expand Down

0 comments on commit b14277f

Please sign in to comment.