მათე Posted January 12, 2016 Share Posted January 12, 2016 მოდით აქ დავდოთ ჩვენ მიერ დაწერილი გამოსადეგი სკრიპტები და პროგრამები. კაი ხანია MAC OS X ზე გადავედი ჩემ ლეპტოპზე და ლინუქს არ ვხმარობ ამიტომ ცოტა მოვშორდი მაგ ამბავს ადრე საკმაოდ ბევრს ვწერდი ეგეთებს. ესეც ჩემი ბოლო ნამუშევარი. ეს კურსი ისე მალე იცვლება python-ს პროგრამა გავაკეთე ყოველ ერთ საათში მიწერს ლამაზად notification-ს მარჯვენა ზედა კუთხეში რამდენია კურსი და აიწია თუ არადა რამდენით აი ასეთ ვიდზეა. (ეროვნული ბანკის მონაცემებია ეგ რასაც წერს) #!/usr/bin/env python # -*- coding: utf-8 -*- from mechanize import Browser from BeautifulSoup import BeautifulSoup from pyquery import PyQuery import subprocess mech = Browser() #url = "https://www.nbg.gov.ge/index.php?m=582view-source:https://www.nbg.gov.ge/index.php?m=582" url = "https://www.nbg.gov.ge/index.php?m=582" page = mech.open(url) html = page.read() soup = BeautifulSoup(html) table = soup.find("table", border="0", style="width:100%;") cur = [] for row in table.findAll('tr')[1:]: col = row.findAll('td') cur.append(col[0]) usd = [] pas = [] aiw = [] for line in cur[2].findAll('tr'): usd.append(line) pas.append(line.text) for line in cur[2].findAll('img'): aiw.append(line) nishani = "" if str(aiw[-3]) == '<img src="./images/red.gif" />': nishani = 'აიწია' elif str(aiw[-3]) == '<img src="./images/green.gif" />': nishani = 'დაიწია' notify = pas[-3] notify = notify[3] + " " + notify[:3] + " = " + notify[15:21] + " GEL " + nishani.decode('utf8') + " " + notify[21:] subprocess.Popen("export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ) && notify-send \"%s\"" % notify, shell=True, stdout=subprocess.PIPE).stdout.read() სჭირდება python-ს მოდულები mechanize, BeautifulSoup და linux-ზე (ubuntu-ზე დატესტილია) სამუშაოდ უნდა notify-send ჩაამატედ crontab-ში სიტყვაზე ყოველსაათში და დაგიწერთ. ეს კიდევ ერთი დაემონზე დაფუძნებული პროგრამა ყოველ რაღაც დროში (რამდენსაც მიუთითებ) ცვლის სურათებს. უბუნტუზე ვერ ვნახე ეგ ფუნქცია და ეს გავაკეთე. აქ უნდა შეცვალოთ ეს ხაზი თუ რამდენ ხანში ერთხელ შეცვალოს ფოტო. system ("/usr/bin/env $HOME/wallpaper.py"); sleep(100); /* yovel 100 wamshi */ პირველ ხაზში მიუთითეთ სადაც ქვედა პითონის პროგრამას დააგდებთ იმ ფოლდერის მისამართი. დეფოლტად ხედავთ სადაც უნდა ეგდოს, ხოლო ქვედა მეორე ხაზში მიუთითედ თუ რამდენ ხანში შეცვალოს ვოლფეიფერი. ეს დაემონია და უნდა იქნას გაშვებული user-ს მიერ და არა root-თ. დაკომპილირება ხდება ბრძანებით gcc -o 1 2 სადაც 1 არის დაკომპილირებული ფაილის მისამართი სახელით 2 არის არსებული კოდის ფაილის მისამართი სახელით. ამ სახით უნდა იყოს code.c სახელი რაც გინდათ გაფართოება ქონდეს .c #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> #include <syslog.h> #include <string.h> int main(void) { pid_t pid, sid; pid = fork(); if (pid < 0) { exit(EXIT_FAILURE); } if (pid > 0) { exit(EXIT_SUCCESS); } umask(0); sid = setsid(); if (sid < 0) { exit(EXIT_FAILURE); } if ((chdir("/")) < 0) { exit(EXIT_FAILURE); } close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); while (1) { system ("/usr/bin/env $HOME/wallpaper.py"); sleep(100); /* yovel 100 wamshi */ } exit(EXIT_SUCCESS); } ესეც პითონის სკრიპტი. აქ დაუკვირდით რომ ამ ხაზში ეწეროს ამავე ხაზის ნომერი replace_line(scr_dir, 36, new_last_line) ხოლო სურათების ადგილმდებარეობა არის $HOME/Pictures/Wallpaper სკრიპტი ეძებს მითითებულ დირექტორიაში არსებულ სურათებს ინახავ ერეიში (ბოლო ციფრი მიუთითებს თუ რომელ წევრზეა ეხლა) შემდეგი გაშვებისას კი გადადის შემდეგ სურათზე და ის ციფრი იცვლება. სურათების ამოწურვის მერე იწყებს თავიდან. (ეცადეთ ფოლდერში მხოლოდ სურათები ეყაროს. #!/usr/bin/env python import sys,os import subprocess import getpass username = getpass.getuser() pics_dir = "/home/" + username + "/Pictures/Wallpapers" scr_dir = "/home/" + username + "/wallpaper.py" pics=[] def replace_line(file_name, line_num, text): lines = open(file_name, 'r').readlines() lines[line_num] = text out = open(file_name, 'w') out.writelines(lines) out.close() path = os.path.join(pics_dir, "targetdirectory") for path, subdirs, files in os.walk(pics_dir): for name in files: a = os.path.join(path, name) a = a.replace (" ", "\ ") pics.append(a) fi=open(scr_dir,'rb') lines = fi.readlines() if lines: index = int(lines[-1]) brz = "gsettings set org.gnome.desktop.background picture-uri file://" + pics[index] index = index + 1 new_last_line = str(index) if index == len(pics): new_last_line = "0" os.system(brz) replace_line(scr_dir, 36, new_last_line) 1 2 Quote Link to comment Share on other sites More sharing options...
მათე Posted January 27, 2016 Author Share Posted January 27, 2016 ეს კიდევ ერთი პროგი. linux-ში keyboard-ს შორთქათებზე შესაძლებელია სკრიპტის გაშვების მიბმა. სიტყვაზე print screen-ზე რო მიაბათ ეს სკრიპტი საკმაოდ გაიმარტივებთ ცხოვრებას ეს სკრიპტი გაშვებისას მაუსის კურსორს შეცვლის ჯვარედინზე, თქვენ მონიშნავთ ადგილს და ის ამ ადგილს დაასქრინშოტებს და ავტომატურად ატვირთავს picz.ge-ზე, შემდეგ კი სურათის ლინკს ჩასვამს თქვენს clipboard-ში და თქვენ ზედმეტი წვალების გარეშე ეგრევე დალინკავთ სურათც მარტივი paste-ს საშუალებით ჰა როგორია? #!/usr/bin/env python # -*- coding: utf-8 -*- import selenium import time from selenium import webdriver from selenium.webdriver.common.keys import Keys import pyperclip import subprocess from pyvirtualdisplay import Display SCREENSHOT_FILENAME = "/home/თქვენი_უზერის_სახელი/Pictures/ScreenShot_11.png" p = subprocess.Popen('gnome-screenshot -a --file=%s' % SCREENSHOT_FILENAME, shell=True) display = Display(visible=0, size=(800, 600)) display.start() driver = webdriver.Chrome('/home/თქვენი_უზერის_სახელი/Pictures/chromedriver') driver.get('http://www.picz.ge/scripts/up.py?um=image'); driver.find_element_by_name('file_1').send_keys(SCREENSHOT_FILENAME) driver.find_element_by_name('reducesize').click(); driver.find_element_by_xpath("//*[@id='content']/form/table/tbody/tr[3]/td[2]/input[2]").click(); driver.find_element_by_name('submit').click(); link = driver.find_element_by_name('directlink').get_attribute('value') pyperclip.copy(link) spam = pyperclip.paste() driver.quit() display.stop() a = subprocess.Popen('pico2wave -w lookdave.wav "Screenshot uploaded" && aplay lookdave.wav', shell=True) ჩაწერეთ თქვენი_უზერის_სახელი სადაც ეგ სიტყვა წერია და გაუშვით სკრიპტი. ამოაგდებს ერორს module not found და მაგის სახელს და ამ ბრძანებით დააყენეთ ყველა მოდული რომლის სახელსაც ამოაგდებს ვერ ვნახეო sudo pip install მოდულის_სახელი. ესეც გადაწერეთ აუცილებლად linux-ს ვერსია http://chromedriver.storage.googleapis.com/index.html?path=2.20/ 32 ან 64 იანი რომელიც გაქვთ და ჩააგდეთ Pictures ფოლდერში. ხო chrome უნდა გეყენოთ აუცილებლად. როცა იმუშავებს ამის მერე აგდებთ ამ სკრიპტს სადაც გინდათ და აკეთებთ keyboard shortcut-ს მენიუდან რომელ ღილაკზე ან ღილაკებზე გინდათ. MAC-ს ვერსიაც მაქვს, იქ სისტემას თვითონ ხმოვან ბრძანებაზე მიბმაც შეუძლია და მაგას ვაკეთებ ეხლა, ანუ ბრძანება Mac screenshot გაუშვებს ამ პროგრამას ჩემს MAC os x-ში. იქ სხვანაერია სკრიპტი და თუ გინდათ მომწერეთ და MAC-სთვისაც გამოგიგზავნით. 1 Quote Link to comment Share on other sites More sharing options...
მათე Posted March 16, 2016 Author Share Posted March 16, 2016 ეს ჩემი კიდევ ერთი პროგრამა shift + alt(command) + 6 shortcut-თ ეშვება სასურველი TV show-ების ახალი სერიის გამოსვლამდე დარჩენილ დროს ნახულობს და ასეთი notification-ები გამოაქ და გამოტანის მომენტში ინგლისურად ამბობს ფრაზას: "სერიალის სახელი" coming in 1 week 1 hours ეს სერიალები მაქვს ჩაყრილი Flash, Gotham, Arrow, SHIELD, Walking Dead, Game Of Thrones, Supernatural, Vampire Diareas, Originals, Vikings, Daredevil ძალიან მაგარი text to speech აქვს MAC OS X-ს საღოლ მაგათ. რუსაულადაც და ინგლისურადაც საუკეთესო ხმები ამოვარჩიე და ეგ დავაყენე. ინგლისურად მიყენია დეფოლტად. აი ასეთ ვიდზეა კოდი: #!/usr/bin/env python # -*- coding: utf-8 -*- import subprocess import time import pygtk, gtk, flickrapi import selenium from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select import urllib import sys import re start = 'Countdown:' end = 'Date:' def get_time_until_next_episode(url, seriali): driver = webdriver.PhantomJS('/Users/MRX/programs/phantomjs-2.1.1-macosx/bin/phantomjs') driver.get(url) episode_info = driver.find_element_by_xpath(".//*[@id='next_episode']").text episode_time = str(episode_info).replace('\n', ' ') release_time = re.search('%s(.*)%s' % (start, end), episode_time).group(1).strip() notification = """/usr/local/bin/terminal-notifier -message "%s გამოდის %s-ში" -title 'კინო ანონსი'""" % (seriali, release_time) p = subprocess.Popen('%s' % notification, stdout=subprocess.PIPE, shell=True) sound = 'say "%s coming in %s"' % (seriali, release_time) p = subprocess.Popen('%s' % sound, stdout=subprocess.PIPE, shell=True) time.sleep(1) return release_time get_time_until_next_episode("http://next-episode.net/the-flash", 'Flash') get_time_until_next_episode("http://next-episode.net/gotham", 'Gotham') get_time_until_next_episode("http://next-episode.net/arrow", 'Arrow') get_time_until_next_episode("http://next-episode.net/marvels-agents-of-s.h.i.e.l.d.", 'SHIELD') get_time_until_next_episode("http://next-episode.net/the-walking-dead", 'Walking Dead') get_time_until_next_episode("http://next-episode.net/game-of-thrones", 'Game Of Thrones') get_time_until_next_episode("http://next-episode.net/supernatural", 'Supernatural') get_time_until_next_episode("http://next-episode.net/the-vampire-diaries", 'Vampire Diareas') get_time_until_next_episode("http://next-episode.net/the-originals", 'Originals') get_time_until_next_episode("http://next-episode.net/vikings", 'Vikings') get_time_until_next_episode("http://next-episode.net/marvels-daredevil", 'Daredevil') 2 Quote Link to comment Share on other sites More sharing options...
Dr0idGh0sT Posted March 17, 2016 Share Posted March 17, 2016 კაია Quote Link to comment Share on other sites More sharing options...
მათე Posted March 17, 2016 Author Share Posted March 17, 2016 21 hours ago, Dr0idGh0sT said: კაია მადლობა. აჰა ეგ ბოლო პროგრამა გავაკეთე deb საინსტალაციო ფაილად linux-სთვის. დატესტილია უბუნტუზე 32 და 64 ბიტიან ვერსიებზე და მუშაობს იდიალურად. ამის მერე ის ფაილი დააყენეთ და ტერმინალში რო გახსნით და აკრებთ films.py ეგ შეტყობინებები გამოვა. ეგ სკრიპტი არის /usr/bin/films.py აქ, შემდეგ კი სურვილისამებრ რაიმე კლავიატურის შორთქათს მიაბით და ეგრევე გაეშვება linux-ს არ აქვს კარგი text to speech და ამიტომ ხმოვანი შეტყობინებები ამოვიღე. გავაკეთე 32 და 64 ბიტიანი ვერსიები. გადმოსაწერი ლინკი: http://bin.ge/dl/221725/Desktop-tar.gz.html ლინკი განვაახლე პატარა fix-ები შევიტანე თავზევე გადააწერს upgrade-ს სახით ძველის წაშლა არაა საჭირო Quote Link to comment Share on other sites More sharing options...
Dr0idGh0sT Posted March 17, 2016 Share Posted March 17, 2016 1 hour ago, მათე said: მადლობა. აჰა ეგ ბოლო პროგრამა გავაკეთე deb საინსტალაციო ფაილად linux-სთვის. დატესტილია უბუნტუზე 32 ბიტიან ვერსიაზე და მუშაობს იდიალურად. ერთადერთი რაც ჭირდება მანამ მაგას დააყენებთ არის sudo apt install python-pip ეს ბრძანება, ამის მერე ის ფაილი დააყენეთ და ტერმინალში რო გახსნით და აკრებთ films.py ეგ შეტყობინებები გამოვა. ეგ სკრიპტი არის /usr/bin/films.py აქ, შემდეგ კი სურვილისამებრ რაიმე კლავიატურის შორთქათს მიაბით და ეგრევე გაეშვება linux-ს არ აქვს კარგი text to speech და ამიტომ ხმოვანი შეტყობინებები ამოვიღე. გავაკეთე 32 და 64 ბიტიანი ვერსიები. გადმოსაწერი ლინკი: http://bin.ge/dl/221671/Desktop-tar.gz.html ვინდოუსზე არ ეშვება 2.7.11 ვრსია მაქ პითონის... Quote Link to comment Share on other sites More sharing options...
მათე Posted March 17, 2016 Author Share Posted March 17, 2016 27 minutes ago, Dr0idGh0sT said: ვინდოუსზე არ ეშვება 2.7.11 ვრსია მაქ პითონის... windows-ზე არც მიცდია. კაი ხანია აღარ ვიყენებ მაგ os-ს. მანდ გიწერს რო pygtk მოდული არ გიყენიაო. python-ს მოდულია ეგ უნდა დააყენო. კიდევ შეილება ამოგიგდოს და რასაც დაგიწერს ყველა მოდული უნდა დააყენო. ასევე ესეც დაგჭირდება http://phantomjs.org/download.html windows-ს ვერსია გადაწერე და სადაც ჩააგდებ მერე სრული მისამართით მიუთითე იმ kinoebi.py ფაილში. windows-ში notification საერთოდ აზრზე არ ვარ როგორ კეთდება და არც ხმოვანი ნოტიფიკეიშენი ვიცი ამიტომ ინფორმაცია ჯობია მანდვე ტერმინალშივე დააბეჭდინო. linux-ს ვერსიაში ზემოთ რაც დავდე საინსტალაციო პაკეტი, მაგ ყველაფერს ეგ აკეთებს ისე რომ მხოლოდ აყენებ და ვსო მზადაა გასაშვებად 1 Quote Link to comment Share on other sites More sharing options...
Dr0idGh0sT Posted March 20, 2016 Share Posted March 20, 2016 @მათე რავიცი ამდენი ჩალიჩი... არც ვუყურებ არცერთს, პროსტა გატესტვის მიზნით მინდოდა. თუ გაინტერესებს რანაერად იმუშავებს ვინდოუსზე არაა პრობლემა ვიჩალიჩებ Quote Link to comment Share on other sites More sharing options...
მიშო Posted April 24, 2016 Share Posted April 24, 2016 4 hours ago, მათე said: ეს კიდევ ერთ გამოსადეგი პროგა. windows-სთვის დასახვეწია, ვაპირებ ავამუშავო მარა თავისი ხუშტურები აქვს linux-სა და MAC-სგან განსხვავებით. .... ეს კი კოდი: აუუუუუუ :დ ცვლადებს და მეთოდებს ქართულად რატო არქმევ სახელს ესეთი რეაქცია მქონდა რო დავინახე :დ 1 Quote Link to comment Share on other sites More sharing options...
მათე Posted April 24, 2016 Author Share Posted April 24, 2016 ისე უნდა გადავეჩვიო მაგას. ზოგადად სახელების დარქმევა მიჭირს. Quote Link to comment Share on other sites More sharing options...
მათე Posted May 7, 2016 Author Share Posted May 7, 2016 ესეც ასე საკმაოდ დავხვეწე ეს ტორენტიდან ფილმის გადმოსაწერი. გავაერთიანე ორი ტორენტ საიტი kat (kickasstorrents) და kinozal (რეგისტრაცია უნდა და კოდშიც უნდა ჩაასწოროთ თქვენი login და password) დანარჩენი რავიცი კოდში კომენტარები მაქვს დამატებული დასაწყისშივე და თავად მიხვდებით რა როგორაა. 720p-ს ეძებს დეფაულტად მაგრამ კოდის დასაწყისშივე ნახავთ სადაც შეგიძლიათ 1080p-დ გადააკეთოთ. მისამართები იქნება ჩასასწორებელი და მანდვე ჩაასწორებთ მაგათაც. მეტი არაფერი არ უნდა თვითონ კოდს. პროგრამა სამუშაოდ მოითხოვს chromedriver-ს და მის path-ს სრულად მითითებულს. ასევე import-ებში რა მოდულებიცაა ისენიც უნდა გეყენოთ. პროგრამა იგებს ტერმინალის ფანჯრის width-ს რათა გამოსახულება ასე ლამაზად დაალაგოს. linux-ში და mac-ში დატესტილი მაქვს მუშაობს. windows-ში არ იმუშავებს ამ სახით როგორც არის. ვისაც გაქვთ windows და გიყენიათ python მომწერეთ და დავამატოთ ეგ ფუნქცია windows-სთვისაც. ასევე transmission-ს ტორენტ კლიენტს იყენებს. mac-სთვისასაც და linux-სთვისაც რო აირჩევთ ფილმს ავტომატურად გახსნის პროგრამას და პირდაპირ მოგთხოვთ ფილმის გადმოწერის დაწყებას. windows-ში ამან რო იმუშაოს ამისათვის windows-შიც უნდა დააყენოთ ეს ტორენტ კლიენტი. ან თუ არ გინდათ მაშინ პროგრამა დაბეჭდავს magnet link-ს ან ავტომატურად გადმოწერს torrent files-ს და მის მისამართს დაგიწერთ command line-შივე და მერე თავად გადმოწერთ. ეს მას მერე რაც ზედა პრობლემა დაიფიქსება. ვიდზე ასეთია: ესეც კოდი საკმაოდ დიდია და სპოილერში ჩავსვავ Spoiler #! /usr/bin/env python # -*- coding: utf-8 -*- import certifi import os import re import pyperclip import requests import selenium import subprocess import time import urllib3 from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.common.keys import Keys from sys import platform as _platform #agenerirebs search linkebs titoeuli sitestvis. ezebs 720p filmebs, tu 1080p gindat aq chaasworet 720p-s nacvlad 1080p film_resolution = "720p" #chromedriver-s misamarti chrome_driver_path = 'chromedriver-s misamarti' #phantomjs-s misamarti phantomjs_driver_path = 'phantomjs misamarti araa sawiro' #chromedrivers download folderi (defaultad Download-ebshi iwers) default_download_path = 'downloadebis misamarti' #kinozal-s login da paroli kinozal_login = 'login' kinozal_pass = 'paroli' #igebs terminals fanjris width-s #columns = int(subprocess.check_output(['stty', 'size']).split()[1]) #columns = int(columns) __all__=['getTerminalSize'] def getTerminalSize(): import platform current_os = platform.system() tuple_xy=None if current_os == 'Windows': tuple_xy = _getTerminalSize_windows() if tuple_xy is None: tuple_xy = _getTerminalSize_tput() #sawiroa window-s python-shi cygwin-s xterm-stvis if current_os == 'Linux' or current_os == 'Darwin' or current_os.startswith('CYGWIN'): tuple_xy = _getTerminalSize_linux() if tuple_xy is None: tuple_xy = (80, 25) # default value return tuple_xy def _getTerminalSize_windows(): res=None try: from ctypes import windll, create_string_buffer # stdin handle is -10 # stdout handle is -11 # stderr handle is -12 h = windll.kernel32.GetStdHandle(-12) csbi = create_string_buffer(22) res = windll.kernel32.GetConsoleScreenBufferInfo(h, csbi) except: return None if res: import struct (bufx, bufy, curx, cury, wattr, left, top, right, bottom, maxx, maxy) = struct.unpack("hhhhHhhhhhh", csbi.raw) sizex = right - left + 1 sizey = bottom - top + 1 return sizex, sizey else: return None def _getTerminalSize_tput(): # get terminal width try: import subprocess proc=subprocess.Popen(["tput", "cols"],stdin=subprocess.PIPE,stdout=subprocess.PIPE) output=proc.communicate(input=None) cols=int(output[0]) proc=subprocess.Popen(["tput", "lines"],stdin=subprocess.PIPE,stdout=subprocess.PIPE) output=proc.communicate(input=None) rows=int(output[0]) return (cols,rows) except: return None def _getTerminalSize_linux(): def ioctl_GWINSZ(fd): try: import fcntl, termios, struct, os cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ,'1234')) except: return None return cr cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2) if not cr: try: fd = os.open(os.ctermid(), os.O_RDONLY) cr = ioctl_GWINSZ(fd) os.close(fd) except: pass if not cr: try: cr = (env['LINES'], env['COLUMNS']) except: return None return int(cr[1]), int(cr[0]) if __name__ == "__main__": sizex,sizey=getTerminalSize() columns = sizex if columns < 55: print "gazardet terminalis fanjara siganeshi" exit() print "-" * columns search = raw_input('sheiyvanet filmis saxeli: ') url_kat = 'https://kat.cr/usearch/?q=' + search.replace(' ', '+') + '+' + film_resolution url_kinozal = 'http://kinozal.tv/browse.php?s=' + search.replace(' ', '+') + '+' + film_resolution #aketebs titoeul saitze searchs mititebuli filmistvis source_code = requests.get(url_kat) soup_kat = BeautifulSoup(source_code.text,'lxml') source_code = requests.get(url_kinozal) soup_kinozal = BeautifulSoup(source_code.text,'lxml') #except urllib3.exceptions.SSLError as e: # print "insecure http connection, please fix it" # exit #pasuxs agebs terminalshi gamosaxulebis dalagebulad gamotanaze def show_film_line(p_count, p_seed, p_peer, p_size, p_name, columns): if len(p_count) < 3: delta = 3 - len(p_count) p_count = p_count + ' ' * delta if len(p_seed) < 5: delta = 5 - len(p_seed) p_seed = p_seed + ' ' * delta if len(p_peer) < 5: delta = 5 - len(p_peer) p_peer = p_peer + ' ' * delta if len(p_size) < 8: delta = 8 - len(p_size) p_size = p_size + ' ' * delta film_line = str(p_count) + ' SEED ' + p_seed + ' PEER ' + p_peer + ' SIZE ' + p_size + '> ' + p_name if len(film_line) > columns: print film_line[:columns] bolo = film_line[columns:] parting = columns - 41 for i in re.findall(r'.{1,%s}' % parting,bolo,re.DOTALL): print ' ' * 41 + i else: print film_line return count = 0 found = [] info = {} #kick ass torrent-s searchs shedegebis dalageba for search_item in soup_kat.findAll('tr', {'class' : ['odd', 'even']}): found.append(search_item) print "\n" + (columns / 2 - 9) * "-" + "Kick Ass Torrents:" + (columns / 2 - 9) * "-" + (columns % 2 > 0) * "-" for i in found: name = i.find('a', {'class':'cellMainLink'}).getText() seed = i.find('td', {'class':'green center'}).getText() peer = i.find('td', {'class':'red lasttd center'}).getText() size = i.find('td', {'class':'nobr center'}).getText() if 'MB' in size or int(seed) == 0: continue link = i.find('a', {'title':'Torrent magnet link'}).get('href') info[str(count)]=link p_count = str(count) + '.' show_film_line(p_count, seed, peer, size, name, columns) count += 1 #imaxsovrebs kinozal-s shedegebis dawyebis id-s kinozal_count = count found = [] #kinozal-s searchs shedegebis dalageba for search_item in soup_kinozal.findAll('tr', {'class':'bg'}): found.append(search_item) print "\n" + (columns / 2 - 4) * "-" + "Kinozal:" + (columns / 2 - 4) * "-" + (columns % 2 > 0) * "-" for i in found: name = i.find('td', {'class':'nam'}).getText() seed = i.find('td', {'class':'sl_s'}).getText() peer = i.find('td', {'class':'sl_p'}).getText() size = i.findAll('td', {'class':'s'})[1].getText() if int(seed) == 0 or "МБ".decode('utf-8') in size: continue link = i.find('td', {'class':'nam'}).a['href'] info[str(count)]='http://kinozal.tv' + link p_count = str(count) + '.' show_film_line(p_count, seed, peer, size, name, columns) count += 1 #sasurveli filmis gadmowera orive torrent-dan. kat-dan magnet linkit xolo kinozaldan gadmowerili torrent filit. #kodshi mititebuli direqtoria unda sheicvalos tqven shemtxvevashi sadac iwers browser imit if len(info) < 1: print "filmi aseti dasaxelebit ver moizebna" print "-" * columns exit() else: print "-" * columns print 'gasasvlelad akrifet: "gamosvla", "exit", "00" an daawiret "Ctrl + C"-s' print "-" * columns id = raw_input('gadmosaweri filmis nomeri?: ') print "-" * columns if id == "gamosvla" or id == "exit" or id == "00": exit() else: #igebs ids mixedvit romeli torrent sitidan unda gadmoweros filmi if int(id) >= kinozal_count: f_id = str(info[id]).split('=')[1] dl_url = 'http://dl.kinozal.tv/download.php?id=' + f_id print 'Downloading ', dl_url driver = webdriver.Chrome(chrome_driver_path) #driver = webdriver.PhantomJS(phantomjs_driver_path) driver.get(dl_url); my_window=driver.window_handles[0] window_count=len(driver.window_handles) driver.find_element_by_xpath('.//*[@id="username"]').send_keys(kinozal_login); driver.find_element_by_xpath('.//*[@id="password"]').send_keys(kinozal_pass); driver.find_element_by_xpath('.//*[@id="main"]/div[1]/div/form/div[2]/div[1]/table/tbody/tr[3]/td/input').click(); while window_count > 1: if driver.window_handles[0] == my_window: continue driver.switch_to_window(driver.window_handles[1]) driver.close() driver.switch_to_window(driver.window_handles[0]) driver.find_element_by_xpath('.//*[@id="main"]/div[1]/div/form/div[2]/div[1]/table/tbody/tr[3]/td/input').click(); time.sleep(2) driver.quit() #gadmowerili torrent files misamarti t_file = default_download_path + '\[kinozal.tv\]id' + f_id + '.torrent' else: t_file = info[id] print 'Downloading ', t_file if _platform == "linux" or _platform == "linux2": #GUI os.system('transmission-gtk ' + t_file) #CLI #os.system('transmission-cli ' + t_file) elif _platform == "darwin": #mac-stvis download = ('open -a transmission ' + '%s') % t_file os.system(download) def runAppleScript(appleScript=None): AppleProcess=subprocess.Popen(['osascript', '-'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) AppleProcess.communicate(appleScript)[0] appleScript="""on run tell application "Terminal" to quit end run""" runAppleScript(appleScript) elif _platform == "win32": # Windows print "Here is torrent file link: ", t_file 1 Quote Link to comment Share on other sites More sharing options...
Dr0idGh0sT Posted May 8, 2016 Share Posted May 8, 2016 დავაყენე ახლა მოდულები და ასეთ რაღაცას წერს: Quote Link to comment Share on other sites More sharing options...
Dr0idGh0sT Posted May 8, 2016 Share Posted May 8, 2016 @მათე CMD ფანჯარაში ზუსტად დაწერა ზომა. მაგრამ ამ cygwin-ში ვერ მივხვდი რა ბრძანებით უნდა გავუშვა Quote Link to comment Share on other sites More sharing options...
მათე Posted May 9, 2016 Author Share Posted May 9, 2016 14 hours ago, Dr0idGh0sT said: @მათე CMD ფანჯარაში ზუსტად დაწერა ზომა. მაგრამ ამ cygwin-ში ვერ მივხვდი რა ბრძანებით უნდა გავუშვა cygwin-ში უნდა გადახვიდე სკრიპტი სადაცაა და ./aaaa.py ასე გაუშვა ან python თუა path-ებში python aaaa.py ასე. ზედა სკრიპტი სპოილერში რომელიცაა ჩავასწორე. სკრიპტში დასაწყისში რაც უნდა ყველაფრის მისათითებელი აქვს შეიხედე იმპორტების მერე ეგრევე და მიუთითე შენი მონაცემები და ცადე აბა დანარჩენი ყველაფერი თუ გაქვს windows-ში უნდა დაწეროს magnet link kick ass torrent-სთვის და გადმოწერილი torrent ფაილის მისამართი kinozal-სთვის. transmission არ ვიცი windows-ში როგორ ეშვება cmd-დან თორე ჩავამატებდი პირდაპირ გაეხსნა. Quote Link to comment Share on other sites More sharing options...
Dr0idGh0sT Posted May 9, 2016 Share Posted May 9, 2016 @მათე cygwin ამუშავდა. არადა გუშინც ზუსტად ასე ვშვებოდი სიგანის გამოსათვლელი კოდი cygwin-ში და CMD-ში მუშაობს 100%, მაგრამ IDLE-ს ფანჯარა რო გავადიდე ისევ ის დაწერა რაც მანამდე. დანარჩენი აი ასეა: Quote Link to comment Share on other sites More sharing options...
მათე Posted May 9, 2016 Author Share Posted May 9, 2016 5 minutes ago, Dr0idGh0sT said: @მათე cygwin ამუშავდა. არადა გუშინც ზუსტად ასე ვშვებოდი სიგანის გამოსათვლელი კოდი მუშაობს 100% დანარჩენი აი ასეა: pip install lxml ეს დააყენე და დააიმპორტე აბა ასე import lxml თუ არ გამოვა დაიკიდე მერე ვნახავ რამე windows-ს მანქანაზე და გავასწორებ. Quote Link to comment Share on other sites More sharing options...
Dr0idGh0sT Posted May 9, 2016 Share Posted May 9, 2016 ახლა ახალ ერორს აქვს ადგილი Quote Link to comment Share on other sites More sharing options...
მათე Posted May 9, 2016 Author Share Posted May 9, 2016 31 minutes ago, Dr0idGh0sT said: ახლა ახალ ერორს აქვს ადგილი კარგი მაგას გავასწორებ დავტესტავ მერე wind-შიც და დავდებ მუშა ვერსიას. რავი მგონი ეს ყველაზე გამოსადეგი რამეა. მე ხშირად ვიყენებ. თემასაც გავწმინდავ მოგვინაებით როცა 100% მუშა ვერსია მექნება. მადლობ დახმარებისთვის. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.