mirror of
https://github.com/mmjee/Piped-Material.git
synced 2024-12-06 19:26:36 +01:00
Add an option to disable duplicate history entries
This commit is contained in:
@@ -202,6 +202,11 @@ export default {
|
||||
type: 'bool',
|
||||
default: true
|
||||
},
|
||||
{
|
||||
id: 'disableDuplicateHistoryEntries',
|
||||
type: 'bool',
|
||||
default: false
|
||||
},
|
||||
{
|
||||
id: 'selectedSkip',
|
||||
type: 'select',
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
import { debounce } from 'lodash-es'
|
||||
import { mdiThumbUp, mdiShareVariant, mdiLinkPlus } from '@mdi/js'
|
||||
|
||||
import { addWatchedVideo, updateWatchedVideoProgress, findLastWatch } from '@/store/watched-videos-db'
|
||||
import { PMDB, addWatchedVideo, updateWatchedVideoProgress, findLastWatch } from '@/store/watched-videos-db'
|
||||
import { LibPiped } from '@/tools/libpiped'
|
||||
|
||||
import Player from '@/components/Player.vue'
|
||||
@@ -363,12 +363,6 @@ export default {
|
||||
},
|
||||
|
||||
async getVideoData () {
|
||||
try {
|
||||
this.lastWatch = await findLastWatch(this.videoId)
|
||||
} catch (e) {
|
||||
console.error('Errored while finding last watched', e)
|
||||
}
|
||||
|
||||
const video = await this.fetchVideo()
|
||||
video.videoId = this.videoId
|
||||
video.url = this.$route.fullPath
|
||||
@@ -386,7 +380,25 @@ export default {
|
||||
.replaceAll('https://www.youtube.com', '')
|
||||
.replaceAll('\n', '<br>')
|
||||
)
|
||||
this.dbID = await addWatchedVideo(video)
|
||||
try {
|
||||
if (!this.$store.getters['prefs/getPreference']('disableDuplicateHistoryEntries', false)) {
|
||||
this.dbID = await addWatchedVideo(video)
|
||||
this.lastWatch = await findLastWatch(this.videoId)
|
||||
} else {
|
||||
const dbObj = await findLastWatch(this.videoId)
|
||||
const ts = new Date()
|
||||
await PMDB.watchedVideos.update(dbObj.id, {
|
||||
timestamp: ts,
|
||||
video: this.video
|
||||
})
|
||||
dbObj.timestamp = ts
|
||||
dbObj.video = this.video
|
||||
this.lastWatch = dbObj
|
||||
this.dbID = dbObj.id
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Errored while finding last watched', e)
|
||||
}
|
||||
},
|
||||
|
||||
onTimeUpdate: debounce(function onTimeUpdate (e) {
|
||||
|
||||
@@ -20,6 +20,7 @@ const PrefsStore = {
|
||||
sponsorblock: true,
|
||||
skipToLastPoint: true,
|
||||
clickbaitThumbnailAvoidance: false,
|
||||
disableDuplicateHistoryEntries: false,
|
||||
|
||||
disableCommentsByDefault: false,
|
||||
showRelatedVideos: true,
|
||||
|
||||
@@ -24,7 +24,7 @@ export function updateWatchedVideoProgress (videoID, prog, dur) {
|
||||
}
|
||||
|
||||
export async function findLastWatch (videoId) {
|
||||
const v = await PMDB.watchedVideos.where('videoId').equals(videoId).reverse().sortBy('progressPcnt').limit(1)
|
||||
const v = await PMDB.watchedVideos.where('videoId').equals(videoId).reverse().sortBy('progressPcnt')
|
||||
return v[0]
|
||||
}
|
||||
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
"showMarkers": "আপনি কি বিজ্ঞাপনের (ও অন্য বিভ্রান্তিকর জিনিসের) চিহ্নিতকারী দেখতে চান?",
|
||||
"bufferGoal": "কত সেকেন্ড এর data এনে রাখব যাতে আপানাকে অপেক্ষা না করতে হয়?",
|
||||
"disableCommentsByDefault": "মন্তব্য দেখানোর জন্য আপনার অনুমতি কি চাওয়া উচিত?",
|
||||
"disableDuplicateHistoryEntries": "আপনি যদি একটা video অতীতে দেখে থাকেন তাহলে কি আর ইতিহাস এ অনুলিপি যোগ করব না, শুধু মাত্র কতটা আর কখন দেখেছেন সেটা নবীকরণ করব?",
|
||||
"quality_opts": {
|
||||
"auto": "আপনার অন্তর্জালের গতি অনুযায়ী",
|
||||
"144p": "১৪৪ বিন্দু আরোহ",
|
||||
|
||||
@@ -141,6 +141,7 @@
|
||||
"disableCommentsByDefault": "Don't show comments by default",
|
||||
"showRelatedVideos": "Show Related Videos",
|
||||
"showMarkers": "Show SponsorBlock Markers",
|
||||
"disableDuplicateHistoryEntries": "Disable creation of duplicate watch history entries",
|
||||
"quality_opts": {
|
||||
"auto": "Automatically determined",
|
||||
"144p": "144p",
|
||||
|
||||
Reference in New Issue
Block a user