forked from j62/ctbrec
1
0
Fork 0

Add gitattributes and run initial normalization

This commit is contained in:
0xboobface 2019-12-17 21:13:18 +01:00
parent 034fe81081
commit e734d46e9c
7 changed files with 224 additions and 216 deletions

10
.gitattributes vendored Normal file
View File

@ -0,0 +1,10 @@
# Auto detect text files and perform LF normalization
* text=auto
#
# The above will handle all files NOT found below
#
# These files are text and should be normalized (Convert crlf => lf)
*.bat text eol=crlf
*.java text diff=java
*.sh text eol=lf

View File

@ -1,2 +0,0 @@
# Auto detect text files and perform LF normalization
* text=auto

View File

@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink"> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink">
<xs:attribute name="type" type="xs:token" fixed="simple"/> <xs:attribute name="type" type="xs:token" fixed="simple"/>
<xs:attribute name="href" type="xlink:hrefType"/> <xs:attribute name="href" type="xlink:hrefType"/>
<xs:simpleType name="hrefType"> <xs:simpleType name="hrefType">
<xs:restriction base="xs:anyURI"/> <xs:restriction base="xs:anyURI"/>
</xs:simpleType> </xs:simpleType>
<xs:attribute name="show" type="xs:token" fixed="embed"/> <xs:attribute name="show" type="xs:token" fixed="embed"/>
<xs:attribute name="actuate" type="xlink:actuateType" default="onRequest"/> <xs:attribute name="actuate" type="xlink:actuateType" default="onRequest"/>
<xs:simpleType name="actuateType"> <xs:simpleType name="actuateType">
<xs:restriction base="xs:token"> <xs:restriction base="xs:token">
<xs:enumeration value="onLoad"/> <xs:enumeration value="onLoad"/>
<xs:enumeration value="onRequest"/> <xs:enumeration value="onRequest"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
</xs:schema> </xs:schema>

View File

@ -1,33 +1,33 @@
FROM alpine/git as open-m3u8Git FROM alpine/git as open-m3u8Git
WORKDIR /app WORKDIR /app
RUN git clone https://github.com/0xboobface/open-m3u8.git RUN git clone https://github.com/0xboobface/open-m3u8.git
FROM gradle:4.10-jdk10 as open-m3u8Build FROM gradle:4.10-jdk10 as open-m3u8Build
WORKDIR /app/open-m3u8 WORKDIR /app/open-m3u8
COPY --from=open-m3u8Git --chown=gradle:gradle /app /app COPY --from=open-m3u8Git --chown=gradle:gradle /app /app
RUN gradle install RUN gradle install
FROM alpine/git as ctbrecGit FROM alpine/git as ctbrecGit
WORKDIR /app WORKDIR /app
RUN git clone https://github.com/0xboobface/ctbrec.git RUN git clone https://github.com/0xboobface/ctbrec.git
FROM maven:3-jdk-11-slim as ctbrecBuild FROM maven:3-jdk-11-slim as ctbrecBuild
ARG ctbrec ARG ctbrec
ARG versionM3u8 ARG versionM3u8
WORKDIR /app/master WORKDIR /app/master
COPY --from=ctbrecGit /app/ctbrec /app COPY --from=ctbrecGit /app/ctbrec /app
COPY --from=open-m3u8Build /app/open-m3u8/build/libs/ /app/common/libs/ COPY --from=open-m3u8Build /app/open-m3u8/build/libs/ /app/common/libs/
RUN mvn clean install:install-file -Dfile=/app/common/libs/open-m3u8-${versionM3u8}.jar -DgroupId=com.iheartradio.m3u8 -DartifactId=open-m3u8 -Dversion=${versionM3u8} -Dpackaging=jar -DgeneratePom=true RUN mvn clean install:install-file -Dfile=/app/common/libs/open-m3u8-${versionM3u8}.jar -DgroupId=com.iheartradio.m3u8 -DartifactId=open-m3u8 -Dversion=${versionM3u8} -Dpackaging=jar -DgeneratePom=true
RUN mvn clean RUN mvn clean
RUN mvn install RUN mvn install
FROM openjdk:12-alpine FROM openjdk:12-alpine
WORKDIR /app WORKDIR /app
ARG memory ARG memory
ARG version ARG version
ENV artifact ctbrec-server-${version}-final.jar ENV artifact ctbrec-server-${version}-final.jar
ENV path /app/server/target/${artifact} ENV path /app/server/target/${artifact}
COPY --from=ctbrecBuild ${path} ./${artifact} COPY --from=ctbrecBuild ${path} ./${artifact}
EXPOSE 8080 EXPOSE 8080
CMD java ${memory} -cp ${artifact} -Dctbrec.config=/server.json ctbrec.recorder.server.HttpServer CMD java ${memory} -cp ${artifact} -Dctbrec.config=/server.json ctbrec.recorder.server.HttpServer

View File

@ -1,9 +1,9 @@
version: 3 version: 3
services: services:
ctbrec: ctbrec:
ports: ports:
- '8080:8080' - '8080:8080'
volumes: volumes:
- 'ctbrec/config:/root/.config/ctbrec/' - 'ctbrec/config:/root/.config/ctbrec/'
- 'ctbrec/video:/root/ctbrec' - 'ctbrec/video:/root/ctbrec'
image: bounty1342/ctbrec image: bounty1342/ctbrec

View File

@ -1,45 +1,45 @@
Knockout orderable binding Knockout orderable binding
================== ==================
This knockout binding allows to create sortable tables. It works by sorting items in observableArray, so tables rendered by "foreach" binding are automatically refreshed by knockout. This knockout binding allows to create sortable tables. It works by sorting items in observableArray, so tables rendered by "foreach" binding are automatically refreshed by knockout.
##Design Goals ##Design Goals
###Focused only on ordering ###Focused only on ordering
Some other plugins take control of entire table rendering, making it complicated to build arbitrary tables. This plugin is only focused on sorting of observableArrays, leaving rendering of HTML to knockout. It gives freedom of using custom item templates for tables or lists. Some other plugins take control of entire table rendering, making it complicated to build arbitrary tables. This plugin is only focused on sorting of observableArrays, leaving rendering of HTML to knockout. It gives freedom of using custom item templates for tables or lists.
###Controllable from a view model ###Controllable from a view model
When binding applied for the first time it adds extra observables to a view model. So order can be changed programmatically like When binding applied for the first time it adds extra observables to a view model. So order can be changed programmatically like
viewModel.people.orderDirection("desc") viewModel.people.orderDirection("desc")
or or
viewModel.people.orderDirection("lastName") viewModel.people.orderDirection("lastName")
###Minimal view model setup ###Minimal view model setup
There is nothing to be configured on a view model manually to use the plugin. Only bindings have to be set on elements which will trigger observableArray to be reordered. There is nothing to be configured on a view model manually to use the plugin. Only bindings have to be set on elements which will trigger observableArray to be reordered.
###Can be used with multiple observableArrays ###Can be used with multiple observableArrays
Works well with multiple observableArray. oservableArrays can be ordered independently of each other. Works well with multiple observableArray. oservableArrays can be ordered independently of each other.
##Usage ##Usage
To make table header sortable set binding like this: To make table header sortable set binding like this:
<th><a href="#" data-bind="orderable: {collection: 'people', field: 'firstName'}">First Name</a></th> <th><a href="#" data-bind="orderable: {collection: 'people', field: 'firstName'}">First Name</a></th>
Default field to sort can also be provided: Default field to sort can also be provided:
<th><a href="#" data-bind="orderable: {collection: 'people', field: 'age', defaultField: true, defaultDirection: 'desc'}">Age</a></th> <th><a href="#" data-bind="orderable: {collection: 'people', field: 'age', defaultField: true, defaultDirection: 'desc'}">Age</a></th>
It's also possible to sort by nested attibutes by separating the attribute names with a dot (should work with array indices too): It's also possible to sort by nested attibutes by separating the attribute names with a dot (should work with array indices too):
<th><a href="#" data-bind="orderable: {collection: 'people', field: 'pet.name'}">Pet name</a></th> <th><a href="#" data-bind="orderable: {collection: 'people', field: 'pet.name'}">Pet name</a></th>
See full examples in examples folder. See full examples in examples folder.
##Dependencies ##Dependencies
- [jQuery](http://jquery.com/) - [jQuery](http://jquery.com/)
- [Knockout](http://knockoutjs.com/) - [Knockout](http://knockoutjs.com/)
##License ##License
MIT license - [http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php) MIT license - [http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php)

View File

@ -1,112 +1,112 @@
ko.bindingHandlers.orderable = { ko.bindingHandlers.orderable = {
getProperty: function(o, s) { getProperty: function(o, s) {
// copied from http://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key // copied from http://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key
s = s.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties s = s.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
s = s.replace(/^\./, ''); // strip a leading dot s = s.replace(/^\./, ''); // strip a leading dot
var a = s.split('.'); var a = s.split('.');
while (a.length) { while (a.length) {
var n = a.shift(); var n = a.shift();
if (n in o) { if (n in o) {
o = o[n]; o = o[n];
} else { } else {
return; return;
} }
} }
return o; return o;
}, },
compare: function (left, right) { compare: function (left, right) {
if (typeof left === 'string' || typeof right === 'string') { if (typeof left === 'string' || typeof right === 'string') {
return left ? left.localeCompare(right) : 1; return left ? left.localeCompare(right) : 1;
} }
if (left > right) if (left > right)
return 1; return 1;
return left < right ? -1 : 0; return left < right ? -1 : 0;
}, },
sort: function (viewModel, collection, field) { sort: function (viewModel, collection, field) {
//make sure we sort only once and not for every binding set on table header //make sure we sort only once and not for every binding set on table header
if (viewModel[collection].orderField() == field) { if (viewModel[collection].orderField() == field) {
viewModel[collection].sort(function (left, right) { viewModel[collection].sort(function (left, right) {
var left_field = ko.bindingHandlers.orderable.getProperty(left, field); var left_field = ko.bindingHandlers.orderable.getProperty(left, field);
var right_field = ko.bindingHandlers.orderable.getProperty(right, field); var right_field = ko.bindingHandlers.orderable.getProperty(right, field);
var left_val = (typeof left_field === 'function') ? left_field() : left_field; var left_val = (typeof left_field === 'function') ? left_field() : left_field;
right_val = (typeof right_field === 'function') ? right_field() : right_field; right_val = (typeof right_field === 'function') ? right_field() : right_field;
if (viewModel[collection].orderDirection() == "desc") { if (viewModel[collection].orderDirection() == "desc") {
return ko.bindingHandlers.orderable.compare(right_val, left_val); return ko.bindingHandlers.orderable.compare(right_val, left_val);
} else { } else {
return ko.bindingHandlers.orderable.compare(left_val, right_val); return ko.bindingHandlers.orderable.compare(left_val, right_val);
} }
}); });
} }
}, },
init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
//get provided options //get provided options
var collection = valueAccessor().collection; var collection = valueAccessor().collection;
var field = valueAccessor().field; var field = valueAccessor().field;
//add a few observables to ViewModel to track order field and direction //add a few observables to ViewModel to track order field and direction
if (viewModel[collection].orderField == undefined) { if (viewModel[collection].orderField == undefined) {
viewModel[collection].orderField = ko.observable(); viewModel[collection].orderField = ko.observable();
} }
if (viewModel[collection].orderDirection == undefined) { if (viewModel[collection].orderDirection == undefined) {
viewModel[collection].orderDirection = ko.observable("asc"); viewModel[collection].orderDirection = ko.observable("asc");
} }
var defaultField = valueAccessor().defaultField; var defaultField = valueAccessor().defaultField;
var defaultDirection = valueAccessor().defaultDirection || "asc"; var defaultDirection = valueAccessor().defaultDirection || "asc";
if (defaultField) { if (defaultField) {
viewModel[collection].orderField(field); viewModel[collection].orderField(field);
viewModel[collection].orderDirection(defaultDirection); viewModel[collection].orderDirection(defaultDirection);
ko.bindingHandlers.orderable.sort(viewModel, collection, field); ko.bindingHandlers.orderable.sort(viewModel, collection, field);
} }
//set order observables on table header click //set order observables on table header click
$(element).click(function (e) { $(element).click(function (e) {
e.preventDefault(); e.preventDefault();
//flip sort direction if current sort field is clicked again //flip sort direction if current sort field is clicked again
if (viewModel[collection].orderField() == field) { if (viewModel[collection].orderField() == field) {
if (viewModel[collection].orderDirection() == "asc") { if (viewModel[collection].orderDirection() == "asc") {
viewModel[collection].orderDirection("desc"); viewModel[collection].orderDirection("desc");
} else { } else {
viewModel[collection].orderDirection("asc"); viewModel[collection].orderDirection("asc");
} }
} }
viewModel[collection].orderField(field); viewModel[collection].orderField(field);
}); });
//order records when observables changes, so ordering can be changed programmatically //order records when observables changes, so ordering can be changed programmatically
viewModel[collection].orderField.subscribe(function () { viewModel[collection].orderField.subscribe(function () {
ko.bindingHandlers.orderable.sort(viewModel, collection, field); ko.bindingHandlers.orderable.sort(viewModel, collection, field);
}); });
viewModel[collection].orderDirection.subscribe(function () { viewModel[collection].orderDirection.subscribe(function () {
ko.bindingHandlers.orderable.sort(viewModel, collection, field); ko.bindingHandlers.orderable.sort(viewModel, collection, field);
}); });
}, },
update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
//get provided options //get provided options
var collection = valueAccessor().collection; var collection = valueAccessor().collection;
var field = valueAccessor().field; var field = valueAccessor().field;
var isOrderedByThisField = viewModel[collection].orderField() == field; var isOrderedByThisField = viewModel[collection].orderField() == field;
//apply css binding programmatically //apply css binding programmatically
ko.bindingHandlers.css.update( ko.bindingHandlers.css.update(
element, element,
function () { function () {
return { return {
sorted: isOrderedByThisField, sorted: isOrderedByThisField,
asc: isOrderedByThisField && viewModel[collection].orderDirection() == "asc", asc: isOrderedByThisField && viewModel[collection].orderDirection() == "asc",
desc: isOrderedByThisField && viewModel[collection].orderDirection() == "desc" desc: isOrderedByThisField && viewModel[collection].orderDirection() == "desc"
}; };
}, },
allBindingsAccessor, allBindingsAccessor,
viewModel, viewModel,
bindingContext bindingContext
); );
} }
}; };