Compare commits

..

4 commits

Author SHA1 Message Date
Matyáš Caras
eb13ce2e41 docs: upravit příklad 2023-04-07 18:22:13 +02:00
Matyáš Caras
817236c98d docs: upravit README 2023-04-07 18:22:05 +02:00
Matyáš Caras
2e8fb36f26 fix: získávat všechny alergeny (#6) 2023-04-07 18:15:13 +02:00
Matyáš Caras
15d5b02073 chore: odstranit cz 2023-04-07 18:14:06 +02:00
6 changed files with 41 additions and 3741 deletions

View file

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2022 Matyáš Caras and contributors Copyright (c) 2022 Matyáš Caras
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View file

@ -12,7 +12,34 @@ Experimentální **neoficiální** webscrape knihovna pro komunikaci se systéme
## To do ## To do
- Kompatibilita se staršími verzemi iCanteen - Kompatibilita se staršími verzemi iCanteen
Příklad používání [zde](https://git.mnau.xyz/hernik/canteenlib/src/branch/main/example/canteenlib_example.dart)
*\* Knihovna nemusí fungovat na všech instancích systému iCanteen, proto žádám každého, kdo může a je uživatelem iCanteen, aby otestoval funkčnost této knihovny a případné problémy [nahlásil](https://git.mnau.xyz/hernik/canteenlib/issues/new)* *\* Knihovna nemusí fungovat na všech instancích systému iCanteen, proto žádám každého, kdo může a je uživatelem iCanteen, aby otestoval funkčnost této knihovny a případné problémy [nahlásil](https://git.mnau.xyz/hernik/canteenlib/issues/new)*
### Otestované instance iCanteen ### Otestované instance iCanteen
[zde](https://git.mnau.xyz/hernik/canteenlib/src/branch/main/COMPATIBILITY.md) [zde](https://git.mnau.xyz/hernik/canteenlib/src/branch/main/COMPATIBILITY.md)
## Licence
```
MIT License
Copyright (c) 2022 Matyáš Caras
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

View file

@ -1,20 +1,15 @@
import 'package:canteenlib/canteenlib.dart'; import 'package:canteenlib/canteenlib.dart';
void main(List<String> args) { void main(List<String> args) async {
Canteen c = Canteen("https://kantyna.neco.cz"); Canteen c = Canteen(
c.login("uzivatel", "heslo").then((value) { "https://kantyna.neco.cz"); // vytvořit instanci kantýny, všechna komunikace probíhá skrz ni
c.jidelnicekDen(den: DateTime.parse("2022-04-04")).then((t) async { try {
await c.login("uzivatel", "heslo"); // přihlásit se
var jidelnicek = await c.jidelnicekDen(den: DateTime.parse("2022-04-04"));
print((await c.ziskejUzivatele()).kredit); print((await c.ziskejUzivatele()).kredit);
c.objednat(t.jidla[0]).then( var objednano = await c.objednat(jidelnicek.jidla[0]);
(value) { print(objednano.objednano);
t.jidla[0] = value; // divně udělané ale nic lepšího teď nevymyslím } catch (e) {
print(t.jidla[0].objednano); print("Při získávání informací nastala chyba: $e");
print(t.jidla[0].orderUrl); }
},
);
});
}).catchError((o) {
print(o);
return null;
});
} }

View file

@ -303,7 +303,7 @@ class Canteen {
.replaceAll(" <br>", "") .replaceAll(" <br>", "")
.replaceAll("\n", ""); .replaceAll("\n", "");
var alergeny = var alergeny =
RegExp(r"""<span title=".+?" class="textGrey">([a-zA-Z]*)<\/span>""") RegExp(r"""<span title=".+?" class="textGrey">(.+?)<\/span>""")
.allMatches(jidlaProDen) .allMatches(jidlaProDen)
.toList(); .toList();
var vydejna = RegExp( var vydejna = RegExp(

3712
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,10 +0,0 @@
{
"devDependencies": {
"cz-conventional-changelog": "^3.3.0"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}