WIP: stats #62

Closed
Xefir wants to merge 6 commits from stats into main
10 changed files with 445 additions and 271 deletions

View File

@ -11,7 +11,7 @@
## Requirements ## Requirements
You need to have [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) installed to use this app!]]></description> You need to have [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) installed to use this app!]]></description>
<version>1.5.8</version> <version>2.0.0</version>
<licence>agpl</licence> <licence>agpl</licence>
<author mail="xefir@crystalyx.net" homepage="https://crystalyx.net">Michel Roux</author> <author mail="xefir@crystalyx.net" homepage="https://crystalyx.net">Michel Roux</author>
<namespace>RePod</namespace> <namespace>RePod</namespace>

View File

@ -3,10 +3,10 @@
"description": "🔊 Browse, manage and listen to podcasts", "description": "🔊 Browse, manage and listen to podcasts",
"type": "project", "type": "project",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"version": "1.5.8", "version": "2.0.0",
"require-dev": { "require-dev": {
"nextcloud/ocp": "^28.0.2", "nextcloud/ocp": "^28.0.2",
"psalm/phar": "^5.21.1", "psalm/phar": "^5.22.2",
"nextcloud/coding-standard": "^1.2.1" "nextcloud/coding-standard": "^1.2.1"
}, },
"scripts": { "scripts": {

26
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "93dd64f58575b16d702d1e405e9d70d8", "content-hash": "cb4ec251acd69af8f979ab04bb47efff",
"packages": [], "packages": [],
"packages-dev": [ "packages-dev": [
{ {
@ -94,16 +94,16 @@
}, },
{ {
"name": "php-cs-fixer/shim", "name": "php-cs-fixer/shim",
"version": "v3.49.0", "version": "v3.50.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHP-CS-Fixer/shim.git", "url": "https://github.com/PHP-CS-Fixer/shim.git",
"reference": "f7d3219cac46632f12362c9aa7c2ac0d2fe92c52" "reference": "8f741bccc45ef07e046040d136da37be720531a8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/f7d3219cac46632f12362c9aa7c2ac0d2fe92c52", "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/8f741bccc45ef07e046040d136da37be720531a8",
"reference": "f7d3219cac46632f12362c9aa7c2ac0d2fe92c52", "reference": "8f741bccc45ef07e046040d136da37be720531a8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -140,22 +140,22 @@
"description": "A tool to automatically fix PHP code style", "description": "A tool to automatically fix PHP code style",
"support": { "support": {
"issues": "https://github.com/PHP-CS-Fixer/shim/issues", "issues": "https://github.com/PHP-CS-Fixer/shim/issues",
"source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.49.0" "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.50.0"
}, },
"time": "2024-02-02T00:42:09+00:00" "time": "2024-02-23T23:18:17+00:00"
}, },
{ {
"name": "psalm/phar", "name": "psalm/phar",
"version": "5.22.0", "version": "5.22.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/psalm/phar.git", "url": "https://github.com/psalm/phar.git",
"reference": "a0b15d6ef1f459bceaf3d5bac3076d5c60de8255" "reference": "380b34d2b19c5a48a201e6f84fab5388c5eced49"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/psalm/phar/zipball/a0b15d6ef1f459bceaf3d5bac3076d5c60de8255", "url": "https://api.github.com/repos/psalm/phar/zipball/380b34d2b19c5a48a201e6f84fab5388c5eced49",
"reference": "a0b15d6ef1f459bceaf3d5bac3076d5c60de8255", "reference": "380b34d2b19c5a48a201e6f84fab5388c5eced49",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -175,9 +175,9 @@
"description": "Composer-based Psalm Phar", "description": "Composer-based Psalm Phar",
"support": { "support": {
"issues": "https://github.com/psalm/phar/issues", "issues": "https://github.com/psalm/phar/issues",
"source": "https://github.com/psalm/phar/tree/5.22.0" "source": "https://github.com/psalm/phar/tree/5.22.2"
}, },
"time": "2024-02-14T04:45:27+00:00" "time": "2024-02-22T23:45:18+00:00"
}, },
{ {
"name": "psr/clock", "name": "psr/clock",

568
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{ {
"name": "repod", "name": "repod",
"description": "🔊 Browse, manage and listen to podcasts", "description": "🔊 Browse, manage and listen to podcasts",
"version": "1.5.8", "version": "2.0.0",
"bugs": { "bugs": {
"url": "https://git.crystalyx.net/Xefir/repod/issues" "url": "https://git.crystalyx.net/Xefir/repod/issues"
}, },
@ -19,12 +19,14 @@
}, },
"dependencies": { "dependencies": {
"@nextcloud/axios": "^2.4.0", "@nextcloud/axios": "^2.4.0",
"@nextcloud/dialogs": "^5.1.1", "@nextcloud/dialogs": "^5.1.2",
"@nextcloud/initial-state": "^2.1.0", "@nextcloud/initial-state": "^2.1.0",
"@nextcloud/l10n": "^2.2.0", "@nextcloud/l10n": "^2.2.0",
"@nextcloud/router": "^3.0.0", "@nextcloud/router": "^3.0.0",
"@nextcloud/vue": "^8.6.2", "@nextcloud/vue": "^8.7.1",
"chart.js": "^4.4.1",
"vue": "^2", "vue": "^2",
"vue-chartjs": "^5.3.0",
"vue-material-design-icons": "^5.3.0", "vue-material-design-icons": "^5.3.0",
"vue-router": "^3", "vue-router": "^3",
"vuex": "^3" "vuex": "^3"

View File

@ -0,0 +1,25 @@
<template>
<NcAppNavigationItem :href="generateUrl('/settings/user/gpoddersync')"
:name="t('repod', 'List subscriptions')">
<template #icon>
<OpenInNewIcon :size="20" />
</template>
</NcAppNavigationItem>
</template>
<script>
import { NcAppNavigationItem } from '@nextcloud/vue'
import OpenInNewIcon from 'vue-material-design-icons/OpenInNew.vue'
import { generateUrl } from '@nextcloud/router'
export default {
name: 'List',
components: {
NcAppNavigationItem,
OpenInNewIcon,
},
methods: {
generateUrl,
},
}
</script>

View File

@ -0,0 +1,21 @@
<template>
<NcAppNavigationItem :name="t('repod', 'Statistics')"
to="/stats">
<template #icon>
<ChartBoxOutlineIcon :size="20" />
</template>
</NcAppNavigationItem>
</template>
<script>
import ChartBoxOutlineIcon from 'vue-material-design-icons/ChartBoxOutline.vue'
import { NcAppNavigationItem } from '@nextcloud/vue'
export default {
name: 'Stats',
components: {
ChartBoxOutlineIcon,
NcAppNavigationItem,
},
}
</script>

View File

@ -23,6 +23,8 @@
<Speed /> <Speed />
<Import /> <Import />
<Export /> <Export />
<List />
<Stats />
</NcAppNavigationSettings> </NcAppNavigationSettings>
</template> </template>
</AppNavigation> </AppNavigation>
@ -35,9 +37,11 @@ import Export from '../Settings/Export.vue'
import Filters from '../Settings/Filters.vue' import Filters from '../Settings/Filters.vue'
import Import from '../Settings/Import.vue' import Import from '../Settings/Import.vue'
import Item from './Item.vue' import Item from './Item.vue'
import List from '../Settings/List.vue'
import Loading from '../Atoms/Loading.vue' import Loading from '../Atoms/Loading.vue'
import Plus from 'vue-material-design-icons/Plus.vue' import Plus from 'vue-material-design-icons/Plus.vue'
import Speed from '../Settings/Speed.vue' import Speed from '../Settings/Speed.vue'
import Stats from '../Settings/Stats.vue'
import { showError } from '@nextcloud/dialogs' import { showError } from '@nextcloud/dialogs'
export default { export default {
@ -48,12 +52,14 @@ export default {
Filters, Filters,
Import, Import,
Item, Item,
List,
Loading, Loading,
NcAppContentList, NcAppContentList,
NcAppNavigationNew, NcAppNavigationNew,
NcAppNavigationSettings, NcAppNavigationSettings,
Plus, Plus,
Speed, Speed,
Stats,
}, },
data() { data() {
return { return {

View File

@ -1,6 +1,7 @@
import Discover from './views/Discover.vue' import Discover from './views/Discover.vue'
import Feed from './views/Feed.vue' import Feed from './views/Feed.vue'
import Router from 'vue-router' import Router from 'vue-router'
import Statistics from './views/Statistics.vue'
import Vue from 'vue' import Vue from 'vue'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
@ -13,6 +14,10 @@ const router = new Router({
path: '/', path: '/',
component: Discover, component: Discover,
}, },
{
path: '/stats',
component: Statistics,
},
{ {
path: '/:url', path: '/:url',
component: Feed, component: Feed,

51
src/views/Statistics.vue Normal file
View File

@ -0,0 +1,51 @@
<template>
<AppContent>
<Loading v-if="loading" />
</AppContent>
</template>
<script>
import AppContent from '../components/Atoms/AppContent.vue'
import Loading from '../components/Atoms/Loading.vue'
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
import { showError } from '@nextcloud/dialogs'
export default {
name: 'Statistics',
components: {
AppContent,
Loading,
},
data() {
return {
loading: true,
since: 0,
stats: [],
}
},
mounted() {
this.fetchData()
},
methods: {
async fetchData() {
try {
this.loading = true
const stats = []
const episodes = await axios.get(generateUrl('/apps/gpoddersync/episode_action?since={since}', { since: this.since }))
for (const action of episodes.data) {
if (action.position > 0) {
stats[action.podcast] += action.position
}
}
this.stats = stats
} catch (e) {
console.error(e)
showError(t('repod', 'Error while fetching the statistics'))
} finally {
this.loading = false
}
},
},
}
</script>