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

View File

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