Version 1.0
This commit is contained in:
parent
2390f7f138
commit
ad97745580
28
README.md
28
README.md
@ -0,0 +1,28 @@
|
|||||||
|
# What did I use?
|
||||||
|
Firstly, I must thank https://github.com/xavery/
|
||||||
|
I use so much your work. Thank You
|
||||||
|
|
||||||
|
# Instalation
|
||||||
|
```sh
|
||||||
|
git clone https://github.com/linux923344/rozklad-mpk.git
|
||||||
|
```
|
||||||
|
In the `start.sh` you must change varable `HTML` , because your schadule will be on the `your-page.pl/rozklad`.
|
||||||
|
For example if you change it for `test123` You will have `your-page.pl/test123`
|
||||||
|
|
||||||
|
The script will NOT create a new directory ;)
|
||||||
|
|
||||||
|
Also you can change the varable `lines`. I added my favourites line like `KORN42 MURA42 OPL01 ORZE42 RKAP73 SOB42 UAMB01`.
|
||||||
|
|
||||||
|
# Starting script
|
||||||
|
If you want to start the script you can run
|
||||||
|
```sh
|
||||||
|
./start.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
# Simple
|
||||||
|
My schadule is in the http://yorune.pl/rozklad/
|
||||||
|
|
||||||
|
# Contact with me
|
||||||
|
You can write e-mail to me y0rune@aol.com
|
||||||
|
|
||||||
|
|
11
rozklad
Executable file
11
rozklad
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
peka_vm_get()
|
||||||
|
{
|
||||||
|
curl -H 'Content-Type:application/x-www-form-urlencoded; charset=UTF-8' \
|
||||||
|
http://www.peka.poznan.pl/vm/method.vm \
|
||||||
|
-d "method=$1" \
|
||||||
|
-d "p0=$2" \
|
||||||
|
-s
|
||||||
|
}
|
||||||
|
|
||||||
|
peka_vm_get getTimes '{"symbol":"'$1'"}' | jq -r '.[] | [.times] | .[] | .[] | [.minutes,.line,.direction] | @csv' | awk -v FS="," 'BEGIN{print "Min\tLine\tDirection\t";print "==================================="}{printf "%s\t%s\t%s%s",$1,$2,$3,ORS}'
|
11
schedule
Executable file
11
schedule
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
peka_vm_get()
|
||||||
|
{
|
||||||
|
curl -H 'Content-Type:application/x-www-form-urlencoded; charset=UTF-8' \
|
||||||
|
http://www.peka.poznan.pl/vm/method.vm \
|
||||||
|
-d "method=$1" \
|
||||||
|
-d "p0=$2" \
|
||||||
|
-s
|
||||||
|
}
|
||||||
|
|
||||||
|
peka_vm_get getTimes '{"symbol":"'$1'"}' | jq -r '.[] | [.times] | .[] | .[] | [.minutes,.line,.direction] | @csv' | awk -v FS="," 'BEGIN{print "Min\tLine\tDirection\t";print "==================================="}{printf "%s\t%s\t%s%s",$1,$2,$3,ORS}'
|
63
start.sh
Executable file
63
start.sh
Executable file
@ -0,0 +1,63 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#-----CHANGE IT------
|
||||||
|
|
||||||
|
HTML="../rozklad"
|
||||||
|
lines=(KORN42 MURA42 OPL01 ORZE42 RKAP73 SOB42 UAMB01)
|
||||||
|
|
||||||
|
#-------------------
|
||||||
|
|
||||||
|
mkdir -p ./lines
|
||||||
|
LINE=$1
|
||||||
|
output=$(echo "\$output")
|
||||||
|
for line in "${lines[@]}"; do
|
||||||
|
cat << EOF > lines/$line.php
|
||||||
|
<?php
|
||||||
|
$output = shell_exec('../schedule $line');
|
||||||
|
echo "<pre>$output</pre>";
|
||||||
|
?>
|
||||||
|
EOF
|
||||||
|
done
|
||||||
|
|
||||||
|
#CREATE INDEX
|
||||||
|
cat << EOF > index.php
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>POZNAŃ Rozkład Jazdy</title>
|
||||||
|
<script language="javascript">
|
||||||
|
function SelectRedirect(){
|
||||||
|
switch(document.getElementById('s1').value)
|
||||||
|
{
|
||||||
|
EOF
|
||||||
|
|
||||||
|
for line in "${lines[@]}"; do
|
||||||
|
cat << EOF >> index.php
|
||||||
|
case "$line":
|
||||||
|
window.location="$HTML/lines/$line.php";
|
||||||
|
break;
|
||||||
|
EOF
|
||||||
|
done
|
||||||
|
|
||||||
|
cat << EOF >> index.php
|
||||||
|
}// end of switch
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<SELECT id="s1" NAME="section" onChange="SelectRedirect();">
|
||||||
|
<Option value="">Select Tram</option>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
for line in "${lines[@]}"; do
|
||||||
|
cat << EOF >> index.php
|
||||||
|
<Option value="$line">$line</option>
|
||||||
|
EOF
|
||||||
|
done
|
||||||
|
|
||||||
|
cat << EOF >> index.php
|
||||||
|
</SELECT>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user