#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Tubedl Video İndirme Aracı
# http://tubedl.googlecode.com/
"""
Copyright (C) 2007 - 2008 Oğuzhan Eroğlu
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 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
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, see .
"""
import os
import sys
import re
try:
import urlgrabber
import urlgrabber, urlgrabber.progress
except(ImportError):
print "Hata[0]: Sisteminizde urlgrabber modülü kurulu değil."
sys.exit()
# Uygulama için gerekli olan değişkenleri tanımlıyoruz
prgs = urlgrabber.progress.text_progress_meter()
destek = ("youtube.com", "google.com", "izlesene.com", "trtube.com", "capturetv.com", "vidivodo.com", "metacafe.com", "dailymotion.com", "break.com")
arguman = ("--yardim", "--destek")
yardim_metni = \
"""
Kullanım Şekli: tubedl "adres" [isim veya fonksiyonu] [çevirilecek dosya türü veya fonksiyonu] [ekstra fonksiyon]
İsim Fonksiyonları:
-at = Dosya adı yerine verdiğiniz adresin başlığını yazar.
Çevirme fonksiyonları:
-cevirme = Flv dosyasını çevirmez.
Ekstra Fonksiyonlar:
-flvsil = Flv dosyasını siler.
Desteklenen siteler için "tubedl --destek" komutuna bakın.
Uyarı: Bazı sitelerin adreslerinde & karakteri bulunduğu için adresleri "" karakterleri arasına yazın.
Örnek Kullanım: tubedl http://www.youtube.com/watch?v=YVGj44PeGaI deneme-youtube avi
"""
# Verilen dosya isminin olup olmadığını kontrol ediyoruz.
def dkontrol(dosya_adi, cisim):
def soru():
if cevap == "h":
print "Program sonlandırılıyor..."
sys.exit()
if cevap == "e":
pass
if (os.path.exists("%s.%s" % (dosya_adi, cisim)) or os.path.exists(dosya_adi)):
print "Hata[3] Dosya Hatası:\nBelirtilen dosya zaten var (%s*)." % (dosya_adi)
cevap = raw_input("Devam edilsinmi? ('e'vet, 'h'ayır): ")
soru()
while cevap not in ("e", "h"):
print " * Geçersiz seçenek..."
cevap = raw_input("Devam edilsinmi? ('e'vet, 'h'ayır): ")
soru()
# otomatik isim alma fonksiyonları
def at(url_read, name, cisim):
title = re.compile("