aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Lionel <moi@miquellionel.ovh>2019-05-30 12:08:10 +0200
committerMiquel Lionel <moi@miquellionel.ovh>2019-05-30 12:08:10 +0200
commit6d57c365789ba88499caca64114d234996a0dae8 (patch)
tree994d5bf52634a4e08e3cbc48a0652a83a04c1d2d
parent9ae6167d9b7ce53a273c46cf96cc73aaefb167f9 (diff)
downloadrandopitons-6d57c365789ba88499caca64114d234996a0dae8.tar.gz
randopitons-6d57c365789ba88499caca64114d234996a0dae8.zip
Cleaning this mess
-rw-r--r--[-rwxr-xr-x].README.md.swpbin12288 -> 12288 bytes
-rw-r--r--[-rwxr-xr-x].gitignore0
-rw-r--r--[-rwxr-xr-x].randopitons.sh.swpbin20480 -> 20480 bytes
-rw-r--r--[-rwxr-xr-x]LICENSE0
-rw-r--r--[-rwxr-xr-x]README.md0
-rwxr-xr-x__init__.py0
-rwxr-xr-xalgo.txt0
-rwxr-xr-xcookiejar.txt5
-rwxr-xr-xmatched.txt3
-rwxr-xr-xnohup.out0
-rwxr-xr-xprototyping/__init__.py0
-rwxr-xr-xprototyping/colorcode.py22
-rwxr-xr-xprototyping/errmsg.py7
-rwxr-xr-xprototyping/foldercreating.py82
-rwxr-xr-xprototyping/inputs.py69
-rwxr-xr-xprototyping/main.py46
-rwxr-xr-xprototyping/mapsparsing.py27
-rwxr-xr-xprototyping/randoweb.py133
-rw-r--r--[-rwxr-xr-x]randopitons.7.gzbin466 -> 466 bytes
-rw-r--r--[-rwxr-xr-x]randopitons.sh0
-rwxr-xr-xregions.txt10
-rwxr-xr-xwebregions.txt9
22 files changed, 0 insertions, 413 deletions
diff --git a/.README.md.swp b/.README.md.swp
index aab92eb..aab92eb 100755..100644
--- a/.README.md.swp
+++ b/.README.md.swp
Binary files differ
diff --git a/.gitignore b/.gitignore
index e4b1fcd..e4b1fcd 100755..100644
--- a/.gitignore
+++ b/.gitignore
diff --git a/.randopitons.sh.swp b/.randopitons.sh.swp
index 6cf01b4..6cf01b4 100755..100644
--- a/.randopitons.sh.swp
+++ b/.randopitons.sh.swp
Binary files differ
diff --git a/LICENSE b/LICENSE
index e62ec04..e62ec04 100755..100644
--- a/LICENSE
+++ b/LICENSE
diff --git a/README.md b/README.md
index 7d1f1ff..7d1f1ff 100755..100644
--- a/README.md
+++ b/README.md
diff --git a/__init__.py b/__init__.py
deleted file mode 100755
index e69de29..0000000
--- a/__init__.py
+++ /dev/null
diff --git a/algo.txt b/algo.txt
deleted file mode 100755
index e69de29..0000000
--- a/algo.txt
+++ /dev/null
diff --git a/cookiejar.txt b/cookiejar.txt
deleted file mode 100755
index aafd764..0000000
--- a/cookiejar.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-# HTTP cookie file.
-# Generated by Wget on 2018-11-05 14:28:38.
-# Edit at your own risk.
-
-randopitons.re FALSE / FALSE 1551936517 randop_sess 42ab9339cc2f39b51269fc1e40cce9f29a726c8d
diff --git a/matched.txt b/matched.txt
deleted file mode 100755
index 21fbd22..0000000
--- a/matched.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Cirque de Cilaos
-Cirque de Mafate
-Cirque de Salazie
diff --git a/nohup.out b/nohup.out
deleted file mode 100755
index e69de29..0000000
--- a/nohup.out
+++ /dev/null
diff --git a/prototyping/__init__.py b/prototyping/__init__.py
deleted file mode 100755
index e69de29..0000000
--- a/prototyping/__init__.py
+++ /dev/null
diff --git a/prototyping/colorcode.py b/prototyping/colorcode.py
deleted file mode 100755
index e120109..0000000
--- a/prototyping/colorcode.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# coding: utf-8
-#Simplified color codes here for error/warning/ok and the such.. messages
-#
-#class Colorcode:
-# def __init__(self):
-# self.endcolor='\033[0m'
-# self.bold='\033[1m'
-# self.header='\033[95m'
-# self.okblue='\033[94m'
-# self.okgreen='\033[92m'
-# self.warn='\033[93m'
-# self.fail='\033[91m'
-# self.underline='\033[4m'
-
-endc='\033[0m'
-bold='\033[1m'
-head='\033[95m'
-okblue='\033[94m'
-okgreen='\033[92m'
-warn='\033[93m'
-fail='\033[91m'
-underline='\033[4m'
diff --git a/prototyping/errmsg.py b/prototyping/errmsg.py
deleted file mode 100755
index 8e67d42..0000000
--- a/prototyping/errmsg.py
+++ /dev/null
@@ -1,7 +0,0 @@
-import colorcode as clc
-os=clc.fail+"Operating System error:"+clc.endc
-direxist=clc.warn+clc.bold+"The folder already exists !"+clc.endc
-formaterr=clc.fail+"Something occured with the formating. File is not retrievable, passing on next download."+clc.endc
-sslerr=clc.fail+clc.bold+"SSL Certificate Error. Please check the time on your computer, adjust it accordingly, or wait a bit before retrying the downloads."+clc.endc
-sigkill=clc.fail+"\n\nProcess interrupted by CTRL+C or system."+clc.endc
-"\n\nProcess interrupted by CTRL+C or system."
diff --git a/prototyping/foldercreating.py b/prototyping/foldercreating.py
deleted file mode 100755
index 489d588..0000000
--- a/prototyping/foldercreating.py
+++ /dev/null
@@ -1,82 +0,0 @@
-import subprocess
-import os
-import time
-import colorcode as clc
-import errmsg as e
-import randoweb as rdo
-#global foldernames
-
-thehome=os.path.expanduser("~")
-defoldername="/Randopitons"
-def_folder=thehome+defoldername
-a_folder=0
-
-
-
-
-def defolder():
- try:
- print "\nCreating default folder "+def_folder+" ..."
- os.mkdir(def_folder)
- except OSError,er:
- print e.os
- print format(er)
-
-def mainfolder():
- try:
- a_folder=input("\n\nWhich folder would you want to download the files to [Default to home directory "+def_folder+"]")
- os.mkdir(a_folder)
- print "Folder "+a_folder+" was created successfully"
- except OSError, er:
- #errors out if folder exists else print the error (can be permissions or anything else)
- if e.errno != os.errno.EEXIST:
- raise
- else:
- print e.os
- print format(er)
- pass
-
- except SyntaxError:
- os.mkdir(def_folder)
- except KeyboardInterrupt:
- print e.sigkill
- except:
- raise
-
-def mkfolder(MAIL,PSW,regionnames,foldernames,maptype,ptr,bfn):
-
- try:
- if a_folder==0:
- os.mkdir(os.path.join(def_folder,foldernames[ptr]))
- else:
- os.mkdir(os.path.join(a_folder,foldernames[ptr]))
- #rdo.testalakon()
- rdo.randoweb(MAIL,PSW,regionnames[ptr],maptype,bfn,def_folder+a_str)
- except OSError, er:
- print e.os
- print format(er)
-
-
-def mkallfolder(MAIL,PSW,regionnames,foldernames,maptype,bfn):
- iii=0
- a_str="str"
- try:
- for a_str in foldernames:
- if a_folder==0:
- os.mkdir(os.path.join(def_folder,a_str))
- else:
- os.mkdir(os.path.join(a_folder,a_str))
-
-
- try:
- print "on attaque par le "+regionnames[iii]
- rdo.randoweb(MAIL,PSW,regionnames[iii],maptype,bfn,def_folder+a_str)
- except:
- raise
- iii=iii+1
- #subprocess.call("rm -d "+fullpath)
- print "All folders were created successfully"
- except OSError, er:
- print e.os
- print format(er)
-
diff --git a/prototyping/inputs.py b/prototyping/inputs.py
deleted file mode 100755
index 3b47bef..0000000
--- a/prototyping/inputs.py
+++ /dev/null
@@ -1,69 +0,0 @@
-import getpass
-import colorcode as clc
-import errmsg as e
-
-
-def mapfileinput():
- maptype = 0
- print clc.bold+"\n Which map file extension you would want to download ?"+clc.endc
- print """
- 1. gpx (GPS Exchange Format)
- 2. trk (CompeGPS Land Track File)
- 3. kml (Keyhole Markup Language)\n"""
-
- while maptype<1 or maptype>3:
- try:
- maptype = input("You must enter a number between 1 and 3. Your choice ? ")
- int(maptype)
- except (KeyboardInterrupt, SystemExit):
- print e.sigkill
- exit()
- except SyntaxError:
- print "Defaulting to gpx. If this isn't what you wanted, you can always interrupt the script by pressing "+clc.bold+clc.okblue+"CTRL+C"+clc.endc
- maptype=1
- return maptype
-
-
-def regioninput():
- zone = 0
- print clc.bold+"\n Which zone you would want to download ?"+clc.endc
- print """
- 1. Cirque de Cilaos (Cilaos Circus)
- 2. Cirque de Mafate (Mafate's Circus)
- 3. Cirque de Salazie (Salazie's Circus)
- 4. Est (East)
- 5. Nord (North)
- 6. Ouest (West)
- 7. Sud (South)
- 8. Volcan (Volcano)
- 9. Ailleurs (Elsewhere)
- 10. All \n"""
-
- while zone < 1 or zone > 10:
- try:
- zone = input("You must enter a number between 1 and 10. Your zone [Default is \"All\"]: ")
- int(zone)
- except (KeyboardInterrupt, SystemExit):
- print e.sigkill
- exit()
- except SyntaxError:
- print("\nDefaulting to All. If this isn't what you wanted, you can always interrupt the script by pressing "+clc.bold+clc.okblue+"CTRL+C"+clc.endc)
- zone = 10;
- except NameError:
- print "\nPlease enter a number between 1 and 10."
- zone = 0
- return zone
-
-def loginmail():
- try:
- MAIL=raw_input("Your email to log in to randopitons.re : ")
- except KeyboardInterrupt:
- print e.sigkill
- return MAIL
-
-def loginpass():
- try:
- PSW=getpass.getpass(prompt="Your password to log in to randopitons.re: ")
- except KeyboardInterrupt:
- print e.sigkill
- return PSW
diff --git a/prototyping/main.py b/prototyping/main.py
deleted file mode 100755
index 56f04d6..0000000
--- a/prototyping/main.py
+++ /dev/null
@@ -1,46 +0,0 @@
-import os
-import inputs as io
-
-import colorcode as clc
-foldernames=["Cirque de Cilaos","Cirque de Mafate","Cirque de Salazie","Est","Nord","Ouest","Sud","Volcan","Ailleurs","All"]
-webregionnames=[]
-for i in range(9):
- try:
- leftside=foldernames[i].split(' ')[0].lower()+"-"
- rightside=foldernames[i].split(' ')[2].lower()
- webregionnames.append(leftside+rightside)
- except IndexError,ierr:
- oneside=foldernames[i].split(' ')[0].lower()
- webregionnames.append(oneside)
- pass
-import foldercreating as fdc
-basicfilename=""
-
-print clc.bold+"*************************************************************************************************************"
-print clc.bold+"* Welcome ! *"+clc.endc
-print clc.bold+"* With this script, you will be able to download gpx,trk and kml traces for hitchiking on the Reunion Isle. *"+clc.endc
-print clc.bold+"*************************************************************************************************************"
-zonechoice=io.regioninput()
-zoneptr=zonechoice-1
-maptype=io.mapfileinput()
-MAIL=io.loginmail()
-PSW=io.loginpass()
-
-
-
-if maptype==1:
- basicfilename="f.gpx"
-elif maptype==2:
- basicfilename="f.trk"
-elif maptype==3:
- basicfilename="f.kml"
-
-fdc.mainfolder()
-if zonechoice == 10:
- fdc.mkallfolder(MAIL,PSW,webregionnames,foldernames,maptype,basicfilename)
-else:
- fdc.mkfolder(MAIL,PSW,webregionnames,foldernames,maptype,zoneptr,basicfilename)
-
-
-
-
diff --git a/prototyping/mapsparsing.py b/prototyping/mapsparsing.py
deleted file mode 100755
index 6caa37a..0000000
--- a/prototyping/mapsparsing.py
+++ /dev/null
@@ -1,27 +0,0 @@
-import xml.etree.ElementTree as xmlp
-import re
-import errmsg as reeee
-import os
-def mapparsing(maptype,basicfilename):
- try:
- tree=xmlp.parse(basicfilename)
- root=tree.getroot()
- if maptype==1:
- filename=root[1][0].text+".gpx"
- elif maptype==2:
- thefile=open(basicfilename)
- for i in range(3):
- thefile.readline()
- filename=re.findall(r'\|(.*?)\|', thefile.readline())[0]+".trk"
- elif maptype==3:
- filename= root[0][10][1][0].text+".kml"
- os.rename(basicfilename,filename)
- except OSError, e:
- print reeee.os
- except xmlp.ParseError, er:
- print reeee.formaterr
- print format(er)
- os.remove(basicfilename)
- pass
-
-
diff --git a/prototyping/randoweb.py b/prototyping/randoweb.py
deleted file mode 100755
index 57fd7f3..0000000
--- a/prototyping/randoweb.py
+++ /dev/null
@@ -1,133 +0,0 @@
-# -*- coding: utf-8 -*-
-from requests import session
-import inputs
-from bs4 import BeautifulSoup as bs
-import colorcode as clc
-import errmsg as e
-import os
-import mapsparsing as mpp
-randonb=[]
-a_str="eh"
-baseurl='https://randopitons.re/randonnee/'
-
-def filei(dwnld,fpath):
- try:
- f=open(fpath,'a+')
- gudencoding=dwnld.text.encode('utf-8')
- f.write(gudencoding)
- f.close()
- except:
- raise
-
-
-
-def testalakon():
- payload = {
- 'mail': 'lionel.miquel46@gmail.com',
- 'password': 'VEobWylvUdToab8'
- }
- with session() as c:
- try:
- c.post('https://randopitons.re/connexion', data=payload)
- regionpage = c.get('https://randopitons.re/randonnees/region/cirque-cilaos')
- try:
- wsite=bs(regionpage.text, "lxml")
- print "Voici les donnees:"+regionpage.text
- except:
- raise
- try:
- for i in wsite.find_all('tr'):
- randonb.append(i.get("rid"))
- try:
- randonb.pop(0)
- print "POPPED"
- except:
- raise
- print "Voici les numéros de randos:"
- print randonb
- try:
- for i in randonb:
- print clc.okgreen+"Maybe downloading "+baseurl+i+'/trace/gpx'
- try:
- dwnld = c.get(baseurl+i+'/trace/gpx')
- except:
- raise
- filei(dwnld,'/home/lili/Randopitons/Cirque de Cilaos/f-'+i+'.gpx')
- except:
- raise
- except:
- raise
- except:
- raise
-
-def randoweb(MAIL,PSW,region,maptype,bfn,folderpath):
- payload = {
- 'mail': MAIL,
- 'password': PSW
- }
-
- with session() as c:
-
- try:
- c.post('https://randopitons.re/connexion', data=payload)
- regionpage = c.get('https://randopitons.re/randonnees/region/'+region)
- try:
- wsite=bs(regionpage.text, "lxml")
- print "Voici les donnees:"+regionpage.text
- except:
- raise
- try:
- for i in wsite.find_all('tr'):
- randonb.append(i.get("rid"))
- try:
- randonb.pop(0)
- print "POPPED"
- except:
- raise
- print "Voici les numéros de randos:"
- print randonb
- except:
- raise
-
-
-
- try:
- for i in randonb:
- if maptype==1:
- try:
- print clc.okgreen+"Maybe downloading "+baseurl+i+'/trace/gpx'
- dwnld = c.get(baseurl+i+'/trace/gpx')
- except TypeError:
- pass
- except:
- raise
- filei(dwnld,folderpath+bfn)
- elif maptype==2:
- try:
- print clc.okgreen+"Maybe downloading "+baseurl+i+'/trace/trk'
- dwnld = c.get(baseurl+i+'/trace/trk')
- except TypeError:
- pass
- except:
- raise
- filei(dwnld,folderpath+bfn)
- else:
- try:
- print clc.okgreen+"Maybe downloading "+baseurl+i+'/trace/kml'
- dwnld = c.get(baseurl+i+'/trace/kml')
- except TypeError:
- pass
- except:
- raise
- filei(dwnld,folderpath+bfn)
- except:
- raise
- try:
- mpp.mapparsing(maptype,folderpath+bfn)
- except:
- raise
- print("Finished writing file.")
- except :
- raise
-
-
diff --git a/randopitons.7.gz b/randopitons.7.gz
index 7b6feff..7b6feff 100755..100644
--- a/randopitons.7.gz
+++ b/randopitons.7.gz
Binary files differ
diff --git a/randopitons.sh b/randopitons.sh
index 398b9f1..398b9f1 100755..100644
--- a/randopitons.sh
+++ b/randopitons.sh
diff --git a/regions.txt b/regions.txt
deleted file mode 100755
index 9569285..0000000
--- a/regions.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-Cirque de Cilaos
-Cirque de Mafate
-Cirque de Salazie
-Est
-Nord
-Ouest
-Sud
-Volcan
-Ailleurs
-All
diff --git a/webregions.txt b/webregions.txt
deleted file mode 100755
index 2479442..0000000
--- a/webregions.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-cirque-cilaos
-cirque-mafate
-cirque-salazie
-est
-nord
-ouest
-sud
-volcan
-ailleurs