mirror of
https://github.com/WebTools-NG/WebTools-NG
synced 2024-11-22 11:03:13 +00:00
commit
22ce893f92
4 changed files with 63 additions and 17 deletions
12
CHANGELOG.md
12
CHANGELOG.md
|
@ -1,5 +1,17 @@
|
||||||
# ![Logo](https://github.com/WebTools-NG/WebTools-NG/blob/master/src/assets/WebTools-48x48.png) WebTools-ng Change log
|
# ![Logo](https://github.com/WebTools-NG/WebTools-NG/blob/master/src/assets/WebTools-48x48.png) WebTools-ng Change log
|
||||||
|
|
||||||
|
## V1.1.3 ( Not released yet )
|
||||||
|
|
||||||
|
**Note**: In this version, the following is disabled:
|
||||||
|
|
||||||
|
* Export to xlsx format ([See #331](https://github.com/WebTools-NG/WebTools-NG/issues/331))
|
||||||
|
* Photo export
|
||||||
|
|
||||||
|
**Changes**:
|
||||||
|
|
||||||
|
* [#563 Viewstate copy and User Ratings](https://github.com/WebTools-NG/WebTools-NG/issues/563) (Enhancement)
|
||||||
|
* [#610 Viewstate Copy doesn't copy partial viewed offsets](https://github.com/WebTools-NG/WebTools-NG/issues/610) (Bug)
|
||||||
|
|
||||||
## V1.1.2 ( 20220925 )
|
## V1.1.2 ( 20220925 )
|
||||||
|
|
||||||
**Note**: In this version, the following is disabled:
|
**Note**: In this version, the following is disabled:
|
||||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "webtools-ng",
|
"name": "webtools-ng",
|
||||||
"version": "1.1.2",
|
"version": "1.1.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "webtools-ng",
|
"name": "webtools-ng",
|
||||||
"version": "1.1.2",
|
"version": "1.1.3",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "webtools-ng",
|
"name": "webtools-ng",
|
||||||
"productName": "WebTools-NG",
|
"productName": "WebTools-NG",
|
||||||
"version": "1.1.2",
|
"version": "1.1.3",
|
||||||
"description": "WebTools Next Generation 4 Plex",
|
"description": "WebTools Next Generation 4 Plex",
|
||||||
"author": "dane22 & CPSO",
|
"author": "dane22 & CPSO",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
|
|
|
@ -28,7 +28,7 @@ const viewstate = new class ViewState {
|
||||||
this.genRep = false;
|
this.genRep = false;
|
||||||
this.outFile = '',
|
this.outFile = '',
|
||||||
this.csvStream,
|
this.csvStream,
|
||||||
this.headers = '"library","ratingKey","title","viewCount","viewOffset"'
|
this.headers = '"Library","RatingKey","Title","View Count","View Offset","User Ratings"'
|
||||||
}
|
}
|
||||||
|
|
||||||
async setOwnerStatus( Usr, data ){
|
async setOwnerStatus( Usr, data ){
|
||||||
|
@ -85,23 +85,34 @@ const viewstate = new class ViewState {
|
||||||
}
|
}
|
||||||
|
|
||||||
async bumpViewCount( media ){
|
async bumpViewCount( media ){
|
||||||
const ratingKey = JSONPath({path: `$..ratingKey`, json: media});
|
const ratingKey = media['ratingKey'];
|
||||||
const title = JSONPath({path: `$..title`, json: media});
|
const title = media['title'];
|
||||||
const viewCount = JSONPath({path: `$..viewCount`, json: media});
|
const viewCount = media['viewCount'];
|
||||||
const viewOffset = JSONPath({path: `$..viewOffset`, json: media});
|
const duration = media['duration'];
|
||||||
const duration = JSONPath({path: `$..duration`, json: media});
|
const viewOffset = media['viewOffset'];
|
||||||
|
let userRating;
|
||||||
|
if ( media['userRating'] ) {
|
||||||
|
userRating = media['userRating']
|
||||||
|
} else {
|
||||||
|
userRating = wtconfig.get('ET.NotAvail', 'N/A');
|
||||||
|
}
|
||||||
if ( this.genRep ){
|
if ( this.genRep ){
|
||||||
let watchTime = await time.convertMsToTime(viewOffset);
|
let watchTime;
|
||||||
if ( watchTime === "00:00:00"){
|
if (viewOffset) {
|
||||||
watchTime = "";
|
watchTime = await time.convertMsToTime(viewOffset);
|
||||||
|
if ( watchTime === "00:00:00"){
|
||||||
|
watchTime = "";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
watchTime = `"${watchTime}"`
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
watchTime = wtconfig.get('ET.NotAvail', 'N/A');
|
||||||
}
|
}
|
||||||
else {
|
const row = `"${this.currentLib}",${ratingKey},"${title}",${viewCount},${watchTime},${userRating}\n`;
|
||||||
watchTime = `"${watchTime}"`
|
|
||||||
}
|
|
||||||
const row = `"${this.currentLib}",${ratingKey},"${title}",${viewCount},${watchTime}\n`;
|
|
||||||
this.csvStream.write( row );
|
this.csvStream.write( row );
|
||||||
}
|
}
|
||||||
log.info(`Bumbing viewcount to ${viewCount} for media ${ratingKey}`);
|
log.info(`Bumbing viewcount to ${viewCount} for media ${ratingKey} with a title of: "${title}"`);
|
||||||
let url = `${store.getters.getSelectedServerAddress}/:/scrobble?identifier=com.plexapp.plugins.library&key=${ratingKey}`;
|
let url = `${store.getters.getSelectedServerAddress}/:/scrobble?identifier=com.plexapp.plugins.library&key=${ratingKey}`;
|
||||||
// We need to bump viewcount for target user same amount as for SrcUsr
|
// We need to bump viewcount for target user same amount as for SrcUsr
|
||||||
let header = wtutils.PMSHeader;
|
let header = wtutils.PMSHeader;
|
||||||
|
@ -144,6 +155,28 @@ const viewstate = new class ViewState {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// Do we need to also set a user rating?
|
||||||
|
if ( userRating )
|
||||||
|
{
|
||||||
|
if ( userRating != wtconfig.get('ET.NotAvail', 'N/A') ){
|
||||||
|
url = `${store.getters.getSelectedServerAddress}/:/rate?identifier=com.plexapp.plugins.library&key=${ratingKey}&rating=${userRating}`;
|
||||||
|
await axios({
|
||||||
|
method: 'put',
|
||||||
|
url: url,
|
||||||
|
headers: header
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
if (error.response) {
|
||||||
|
log.error('[viewState.js] (bumpViewCount) viewOffset: ' + JSON.stringify(error.response.data));
|
||||||
|
alert(error.response.data.errors[0].code + " " + error.response.data.errors[0].message);
|
||||||
|
} else if (error.request) {
|
||||||
|
log.error('[viewState.js] (bumpViewCount) viewOffset error: ' + error.request);
|
||||||
|
} else {
|
||||||
|
log.error('[viewState.js] (bumpViewCount) viewOffset last error: ' + error.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
status.updateStatusMsg(status.RevMsgType.TimeElapsed, await time.getTimeElapsed());
|
status.updateStatusMsg(status.RevMsgType.TimeElapsed, await time.getTimeElapsed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,6 +213,7 @@ const viewstate = new class ViewState {
|
||||||
listProcessDetails['viewCount'] = JSONPath({path: `$..viewCount`, json: medias[media]})[0];
|
listProcessDetails['viewCount'] = JSONPath({path: `$..viewCount`, json: medias[media]})[0];
|
||||||
listProcessDetails['duration'] = JSONPath({path: `$..duration`, json: medias[media]})[0];
|
listProcessDetails['duration'] = JSONPath({path: `$..duration`, json: medias[media]})[0];
|
||||||
listProcessDetails['ratingKey'] = JSONPath({path: `$..ratingKey`, json: medias[media]})[0];
|
listProcessDetails['ratingKey'] = JSONPath({path: `$..ratingKey`, json: medias[media]})[0];
|
||||||
|
listProcessDetails['userRating'] = JSONPath({path: `$..userRating`, json: medias[media]})[0];
|
||||||
listProcess[JSONPath({path: `$..ratingKey`, json: medias[media]})[0]] = listProcessDetails;
|
listProcess[JSONPath({path: `$..ratingKey`, json: medias[media]})[0]] = listProcessDetails;
|
||||||
index += 1;
|
index += 1;
|
||||||
this.bumpViewCount( listProcessDetails );
|
this.bumpViewCount( listProcessDetails );
|
||||||
|
|
Loading…
Reference in a new issue