-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 35d84b3
Showing
26 changed files
with
7,626 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
SHELL:=/bin/bash | ||
CFLAGS=-O2 -Wall -Wpedantic -Werror=vla -std=gnu99 -lcurl -lpthread -lbsd -lcjson -ggdb | ||
|
||
BINARY_FILE=cmyflix | ||
|
||
BUILD_DIR=bin/ | ||
BINARY_PATH=${BUILD_DIR}${BINARY_FILE} | ||
|
||
EXTRAS_DIR=extras/ | ||
|
||
DESTDIR=/ | ||
|
||
INSTALL_BIN_DIR=${DESTDIR}usr/local/bin/ | ||
INSTALL_ETC_DIR=${DESTDIR}etc/cmyflix/ | ||
|
||
.PHONY: bin clean ctags deb help install run uninstall valgrind callgrind | ||
|
||
bin: | ||
mkdir -p ${BUILD_DIR} | ||
${CC} src/*.c ${CFLAGS} -o ${BINARY_PATH} | ||
cp -r ${EXTRAS_DIR}* ${BUILD_DIR} | ||
|
||
clean: | ||
rm -rf ${BUILD_DIR} | ||
@rm -rf deb | ||
|
||
ctags: | ||
@ctags -R --exclude=.git -f .tags src/ extras/ | ||
|
||
help: | ||
@echo -e "The following are some of the valid targets for this Makefile:\n\tbin (the default if no target is provided)\n\tclean\n\tctags\n\thelp\n\tinstall\n\trun\n\tuninstall\n\tvalgrind\n\tcallgrind\n\tdeb\n" | ||
|
||
install: bin | ||
ifneq ($(shell id -u), 0) | ||
@echo "You must be root to perform this action." | ||
else | ||
install -d ${INSTALL_BIN_DIR} | ||
install -d ${INSTALL_ETC_DIR} | ||
install ${BINARY_PATH} ${INSTALL_BIN_DIR} | ||
cp -r ${EXTRAS_DIR}* ${INSTALL_ETC_DIR} | ||
endif | ||
|
||
run: bin | ||
cd ${BUILD_DIR} && exec ./${BINARY_FILE} && cd ${PWD} | ||
|
||
uninstall: | ||
ifneq ($(shell id -u), 0) | ||
@echo "You must be root to perform this action." | ||
else | ||
rm ${INSTALL_BIN_DIR}${BINARY_FILE} | ||
rm -rf ${INSTALL_ETC_DIR} | ||
endif | ||
|
||
valgrind: bin | ||
cd ${BUILD_DIR} && valgrind --max-threads=4096 --log-file=valgrindLog.txt --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes -s ./${BINARY_FILE} && cat valgrindLog.txt | ||
|
||
callgrind: bin | ||
cd ${BUILD_DIR} && valgrind --tool=callgrind --dump-instr=yes --collect-jumps=yes ./${BINARY_FILE} | ||
|
||
deb: bin | ||
@ARCH_STR=$$(if command -v dpkg &> /dev/null; then dpkg --print-architecture; else arch=$$(uname -m); if [[ $$arch == *"i386"* ]]; then echo "i386"; elif [[ $$arch == *"i686"* ]]; then echo "i386"; elif [[ $$arch == *"x86_64"* ]]; then echo "amd64"; elif [[ $$arch == *"aarch64"* ]]; then echo "arm64"; elif [[ $$arch == *"armv8b"* ]]; then echo "arm64"; elif [[ $$arch == *"armv"*"l" ]]; then echo "armhf"; elif [[ $$arch == *"arm"* ]]; then echo "arm"; fi; fi); \ | ||
VERSION_STR=$$(grep -i '#define VERSION_STRING "' src/main.c | sed -e 's/\#define VERSION_STRING\ //g;s/\"//g'); \ | ||
PKG_DIR=${BINARY_FILE}_$${VERSION_STR}_$${ARCH_STR}; \ | ||
PKG_BIN_DIR=deb/$${PKG_DIR}/usr/local/bin/; \ | ||
PKG_ETC_DIR=deb/$${PKG_DIR}/etc/${BINARY_FILE}/; \ | ||
BIN=${BINARY_PATH}; \ | ||
EXTRAS=${EXTRAS_DIR}*; \ | ||
mkdir -p $${PKG_BIN_DIR}; \ | ||
mkdir -p $${PKG_ETC_DIR}; \ | ||
cp $${BIN} $${PKG_BIN_DIR}; \ | ||
cp -r $${EXTRAS}* $${PKG_ETC_DIR}; \ | ||
mkdir deb/$${PKG_DIR}/DEBIAN; \ | ||
echo -e "Package: cmyflix\nVersion: $${VERSION_STR}\nArchitecture: $${ARCH_STR}\nDepends: ffmpeg,imagemagick,libcjson1\nMaintainer: farfalleflickan <farfalleflickan@gmail.com>\nDescription: A static webpage generator for your movies and tv shows.\n For more info see: https://github.com/farfalleflickan/cmyflix" > deb/$${PKG_DIR}/DEBIAN/control; \ | ||
echo -e "#!/usr/bin/make -f\n%:\n dh $@\noverride_dh_install:\n dh_install $${PKG_ETC_DIR} /etc/${BINARY_FILE}\n" > deb/$${PKG_DIR}/DEBIAN/rules; \ | ||
cd deb && dpkg-deb --build --root-owner-group $${PKG_DIR} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# cmyflix | ||
*A Netflix clone, now in C!* | ||
|
||
cmyflix is also a complete rewrite of my original ![Myflix](https://github.com/farfalleflickan/Myflix/) using C, so it's about 30x **faster** than the original whilst keeping almost all functionality. | ||
|
||
cmyflix tries to be a somewhat simple and lightweight "DIY Netflix", similar to Plex, streama or Emby, for your NAS, especially aimed at the Raspberry Pi/Odroid/etc ecosystem. It's not **meant** or **designed** to be fancy (if you have the hardware and want a ton of functionality, go for other solutions :) ), but the bare minimum to be somewhat pretty, fast and usable. The program create json databases that store the files location and metadata, these databases are then used to create static web pages that can be served from any web server! | ||
|
||
Big props to the following libraries: ![cwalk](https://github.com/likle/cwalk), ![cjson](https://github.com/DaveGamble/cJSON). | ||
If you want to password protect your cmyflix files, you might want to look at ![this](https://github.com/farfalleflickan/JSONlogin)! | ||
|
||
Do you like my work? Feel free to donate :) | ||
[<img src="https://raw.githubusercontent.com/andreostrovsky/donate-with-paypal/master/dark.svg" alt="donation" width="150"/>](https://www.paypal.com/donate?hosted_button_id=YEAQ4WGKJKYQQ) | ||
|
||
# Sreenshots: | ||
TV shows page | ||
![TV shows](https://github.com/farfalleflickan/Myflix/blob/master/screenshots/ec53e53f252f908bc8bac7f8c4486790.jpg) | ||
|
||
TV show season/episode modal | ||
![TV show episodes](https://github.com/farfalleflickan/Myflix/blob/master/screenshots/fb31129a22d81b732ce88f02cae27fea.jpg) | ||
|
||
|
||
TV show episode player | ||
![TV show episode player](https://github.com/farfalleflickan/Myflix/blob/master/screenshots/102b3df4924efeae7476d6ceee79bec9.png) | ||
|
||
Movies page | ||
![Movies](https://github.com/farfalleflickan/Myflix/blob/master/screenshots/d4271907a9af78d8dd84f3941ca1e56a.jpg) | ||
|
||
Movies player | ||
![Movies player](https://github.com/farfalleflickan/Myflix/blob/master/screenshots/2eb41c935d1c11e19adb66466bcdf97e.png) | ||
|
||
# How to compile: | ||
Simply compile by running make, the required libraries are (in Ubuntu) `libbsd-dev libcjson-dev libcurl4-openssl-dev`. | ||
|
||
# How to install: | ||
Either install from source with make install OR use a pre-compiled package from the release tab. | ||
|
||
Beware, the pre-compiled `deb` file is built using the default `libcurl4-openssl-dev` backend. | ||
|
||
# Requirements to run: | ||
cmyflix uses libcjson(>=1.7.15), libcurl(>=7.68), imagemagick, ffmpeg and a TMDB api key. | ||
|
||
# Configuration & usage: | ||
For starters, cmyflix looks for `cmyflix.cfg` first in the same folder as the binary, then in `$HOME/.config/cmyflix/` and lastly in `/etc/cmyflix/`. Same thing applies for folder `html` and its contents. | ||
|
||
For more options and information, look in the configuration file or see the help menu, which can be invoked by passing `--help`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
TVpath="/etc/cmyflix/TV/"; # REMEMBER / at the end of path! identifies the path to the folder containing tv shows | ||
MoviesPath="/etc/cmyflix/Movies/"; # identifies the path to the folder containing movies | ||
|
||
dbNameMovie="/etc/cmyflix/dbM.json"; # identifies path and name of the movie database | ||
dbNameTV="/etc/cmyflix/dbTV.json"; # identifies path and name of the tv show database | ||
|
||
# regex used to identify tv shows, uses the sS1eE01 or sS01eE01 or 01x01 or 1x01 format, in that order | ||
regexTVnum="2"; | ||
regexTVstr1="(.*)[.][sS]([0-9]{1,2})[eE]([0-9]{1,3})[.\-\_](.*)"; | ||
regexTVstr2="(.*)[.]([0-9]{1,2})[x]([0-9]{1,3})[.\-\_](.*)"; | ||
# name of extras folder used to identify tv shows extras, default is "Season.Extra" | ||
TVextraStr="Season.Extra"; | ||
regexTVgroups="5"; # expected number of capture groups of regex | ||
|
||
regexM="(.*)[.](.*)"; # movie regex | ||
|
||
regexHM="([0-9]+\-[0-9]+\-[0-9]+)"; # home movie regex | ||
|
||
TVhtml="/etc/cmyflix/output/TV.html"; # path to the TV html page | ||
showHTMLFolder="/etc/cmyflix/output/shows/"; # path to where to put html of every tv show | ||
Mhtml="/etc/cmyflix/output/Movies.html"; # path to the movie html page | ||
|
||
dTVImg="true"; # download TV poster images true/false | ||
dTVFolder="/etc/cmyflix/output/TVimg/"; # path to folder containing the images once downloaded | ||
AutogenImgResizeTVCmd="convert -background purple -fill white -size 500x735 -pointsize 36 -gravity center caption:"; | ||
compressImgTVCmd="convert -resize 500x -gravity center -crop 500x735+0+0 -strip -interlace Plane -gaussian-blur 0.05 -quality 80%"; #might need some tweaking? | ||
compressImgTV="false"; # wether the image should be comprossed | ||
prefImgWidthTV="2000"; # preferred width of poster image | ||
prefImgRatioTV="0.667"; # preferred width/height ratio of poster image | ||
prefImgLangTV="en"; # preferred language for poster image | ||
|
||
# exactly the same as above | ||
dMoImg="true"; | ||
dMoFolder="/etc/cmyflix/output/MoImg/"; | ||
AutogenImgResizeMoCmd="convert -background purple -fill white -size 500x735 -pointsize 36 -gravity center caption:"; | ||
compressImgMoCmd="convert -resize 500x -gravity center -crop 500x735+0+0 -strip -interlace Plane -gaussian-blur 0.05 -quality 80%"; #might need some tweaking? | ||
compressImgMo="false"; | ||
prefImgWidthM="2000"; | ||
prefImgRatioM="0.667"; | ||
prefImgLangM="en"; | ||
|
||
getTVposter="true"; # download tv show metadata poster | ||
getEpisodeName="true"; # download every episode name | ||
createTVsubs="true"; # search for subs in same folder | ||
|
||
getMposter="true"; # same as above | ||
createMsubs="true"; # search for subs for movies | ||
homeMovies="false"; # $MoviesPath contains home movies, do NOT treat as actual movies. homeMovies are sorted by filename | ||
|
||
fileLimit="8192"; # sets rlimit for max number of open files, 8192 seems a good value | ||
|
||
# your TMDB api key | ||
TMDBapi=""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
border: 0; | ||
} | ||
|
||
/* The Modal (background) */ | ||
.modal { | ||
display: none; /* Hidden by default */ | ||
position: fixed; /* Stay in place */ | ||
z-index: 1; /* Sit on top */ | ||
left: 0; | ||
top: 0; | ||
width: 100%; /* Full width */ | ||
height: 100%; /* Full height */ | ||
overflow: auto; /* Enable scroll if needed */ | ||
background-color: rgb(0,0,0); /* Fallback color */ | ||
background-color: rgba(0,0,0,0.7); /* Black w/ opacity */ | ||
} | ||
|
||
/* Modal Content/Box */ | ||
.modal-content { | ||
background-color: #fefefe; | ||
margin: 5% auto; /* 15% from the top and centered */ | ||
padding: 10px; | ||
border: 1px solid #888; | ||
width: 80%; /* Could be more or less, depending on screen size */ | ||
min-height: 50px; | ||
} | ||
|
||
/* The Close Button */ | ||
.close { | ||
color: #aaa; | ||
float: right; | ||
font-size: 28px; | ||
font-weight: bold; | ||
} | ||
|
||
.close:hover, | ||
.close:focus { | ||
color: black; | ||
text-decoration: none; | ||
cursor: pointer; | ||
} | ||
.movieDiv{ | ||
margin: 5px; | ||
} | ||
|
||
.myBtn { | ||
width: 18vw; | ||
} | ||
|
||
.myBtn:hover { | ||
filter: brightness(30%); | ||
} | ||
|
||
@media only screen and (max-width: 768px) { | ||
.myBtn { | ||
height: auto; | ||
width: 45vw; | ||
} | ||
} | ||
|
||
.video_player{ | ||
width: 80%; | ||
margin-left: 10%; | ||
} | ||
|
||
#wrapper { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: space-around; | ||
} | ||
|
||
#paddingDiv { | ||
content: ""; | ||
width: 0px; | ||
height: 0px; | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
border: 0; | ||
} | ||
|
||
iframe { | ||
width: 100%; | ||
height: 100%; | ||
border: none; | ||
} | ||
|
||
/* The Modal (background) */ | ||
.modal { | ||
display: none; /* Hidden by default */ | ||
position: fixed; /* Stay in place */ | ||
z-index: 1; /* Sit on top */ | ||
left: 0; | ||
top: 0; | ||
width: 100%; /* Full width */ | ||
height: 100%; /* Full height */ | ||
overflow: auto; /* Enable scroll if needed */ | ||
background-color: rgb(0,0,0); /* Fallback color */ | ||
background-color: rgba(0,0,0,0.7); /* Black w/ opacity */ | ||
} | ||
|
||
/* Modal Content/Box */ | ||
.modal-content { | ||
background-color: #fefefe; | ||
margin: auto; | ||
margin-top: 2%; /* 15% from the top and centered */ | ||
padding: 10px; | ||
border: 1px solid #888; | ||
width: 80%; /* Could be more or less, depending on screen size */ | ||
min-height: 50px; | ||
} | ||
|
||
/* The Close Button */ | ||
.close { | ||
color: #aaa; | ||
float: right; | ||
font-size: 28px; | ||
font-weight: bold; | ||
} | ||
|
||
.close:hover, | ||
.close:focus { | ||
color: black; | ||
text-decoration: none; | ||
cursor: pointer; | ||
} | ||
|
||
#epTitle{ | ||
text-align: center; | ||
} | ||
|
||
|
||
|
||
.showDiv{ | ||
margin: 5px; | ||
} | ||
|
||
.myBtn { | ||
width: 19vw; | ||
} | ||
|
||
.myBtn:hover { | ||
filter: brightness(30%); | ||
} | ||
|
||
@media only screen and (max-width: 768px) { | ||
.myBtn { | ||
height:auto; | ||
width: 45vw; | ||
} | ||
} | ||
|
||
.video_player{ | ||
width: 60%; | ||
width: calc(60% - 5px); | ||
margin-left: 20%; | ||
} | ||
|
||
.showEpUl{ | ||
display: none; | ||
list-style-type: none; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
|
||
.epButton{ | ||
border: none; | ||
width: 100%; | ||
margin: 0; | ||
padding: 0; | ||
background-color: #F0F0F0; | ||
} | ||
|
||
|
||
|
||
.epButton:hover { | ||
background-color: #999999; | ||
} | ||
|
||
.nextEpDiv { | ||
width: 100%; | ||
text-align: center; | ||
} | ||
|
||
.nextEpButton { | ||
margin: 0 auto; | ||
display: inline-block; | ||
} | ||
|
||
.prevEpButton { | ||
margin: 0 auto; | ||
display: inline-block; | ||
|
||
} | ||
|
||
.autoButtonLabel { | ||
margin: 0 auto; | ||
display: inline-block; | ||
} | ||
.autoButton { | ||
} | ||
|
||
#wrapper { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: space-around; | ||
} | ||
|
||
#paddingDiv { | ||
content: ""; | ||
width: 0px; | ||
height: 0px; | ||
} | ||
|
||
|
Oops, something went wrong.