Command Line Interface to ariel.unimi.it
The program is just a simple bash script (will try to make it POSIX compliant in the future) so it only works on GNU/Linux and maybe macOS (not tested).
I rewrote the script in go to make it multi-platform and to practise with the language. The bash script has been moved to university-cli.sh while compiled binaries have been moved into bin/.
Install the dependencies then clone the repo
$ git clone https://github.com/mar-foo/university-cli
$ cd university-cliRun
$ ./install.shby default the program is copied to ~/.local/bin, to add it to your $PATH run
$ export PATH="$HOME/.local/bin:${PATH}"Your shell looks for programs in the list of directories stored in this variable, as soon as you close the terminal you are working in the value of the $PATH variable will be overwritten by the default value; to overcome this issue you have to add this configuration to $HOME/.bashrc if you are running bash or $HOME/.zshrc if you are running zsh as your default shell. To do so copy the following command:
$ echo 'export PATH="$HOME/.local/bin:${PATH}"' >> ~/.bashrc # If running bash
$ echo 'export PATH="$HOME/.local/bin:${PATH}"' >> ~/.zshrc # If running zshHaving a go version of the program makes it possible to cross compile it for Windows, I don't have any Windows machine at the moment so I can't test wether it works or not.
Install the dependencies then clone the repo
> git clone https://github.com/mar-foo/university-cli
> cd university-cliMove the executable in a directory in your PATH, you will find it in bin/windows/university-cli.exe.
Copy the executable directly from this webpage: you can find it in bin/windows/university-cli.exe and save it in a directory in your PATH.
Consider downloading git because you can use it to automatically update to the newest version.
If you want to help with the development yourself you will need to be able to compile the source code into an executable, to do so i use go: cd into the installation directory and run:
$ go build university-cli.goThis will create the new executable in the directory root.
- dmenu to choose videos to download/stream (
university-cli.shonly) - mpv to stream videos (
university-cli.shonly) - youtube-dl to download videos
- ffmpeg to encode videos
At the moment you need to have the html source code for the webpage of the course downloaded to a file called webpage.html, to download it look up the documentation for your web browser.
university-cli will look for the webpage file in the current directory, so first you have to create a directory in which you want to store the videos and then cd into it, e.g. to download videos in ~/Documents/University/Videos do:
$ mkdir -p ~/Documents/University/Videos ; cd ~/Documents/University/Videos # make the directory if it is not there
$ # make sure you have the webpage file in this directory
$ university-cli -DFull list of command line options:
university-cli -ccheck for videos that were not downloadeduniversity-cli -dprompt for a video to download (usesdmenu) (university-cli.shonly)university-cli -Ddownload all of the .mp4 files found on the webpageuniversity-cli -s [SPEED]set speed of the download (has to be set as first option to work), possible values are 'fast' or 'slow'university-cli -vprompt for a video to stream (usesmpv) (university-cli.shonly)university-cli -hprints usage information
Regarding the -s option: the 'fast' method uses youtube-dl's default encoding, output files will be bigger in size but will be encoded faster; on the other hand the 'slow' method uses ffmpeg with the options specified here which will result in smaller files but will require more time to encode. If no option is specified the default value is 'fast'.
Using the same example directory ~/Documents/University/Videos, to view a video lesson you would run:
$ cd ~/Documents/University/Videos
$ university-cli.sh -v # Prompt for a lesson to streamby default it will look for a local file that matches the chosen name in the current directory, if it is not there it will stream it.
To see if university-cli -D worked you can check that every file has been downloaded:
$ university-cli -c # or university-cli --checkTo keep the installation up to date periodically cd into the directory where you cloned the repository and run:
$ git pullAnd repeat the steps you followed when installing.
The project is still immature, in the future this wants to be an ncurses/cli interface to browse Ariel.
At the moment the bash script university-cli.sh supports more options, but I'm definitively switching to the GoLang version so I'll implement all of those features in the future.
- Test for different courses: teachers might store their lessons on different sites which might not be supported by youtube-dl
- Fix issue with spaces: if the filename contains a space then the program might act weird
- Add a test to check if every lesson has been installed by
-Doption
I wrote this little program for myself, if you need/want new features patches are welcome, if you find any bugs file an issue on github and I'll try to figure it out.
This project is not endorsed or approved by the "Universita degli Studi di Milano", all of the content stored on ariel is protected by copyright as stated by unimi and should be used according to the rules.