Skip to content

Commit

Permalink
merge release/1.2.0 into master
Browse files Browse the repository at this point in the history
merge release/1.2.0 into master
Merge pull request #19 from chrisism/release/1.2.0
  • Loading branch information
chrisism authored Nov 25, 2022
2 parents 3b8e862 + 65be767 commit abc2cbb
Show file tree
Hide file tree
Showing 20 changed files with 395 additions and 204 deletions.
30 changes: 25 additions & 5 deletions .build/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,13 @@ stages:
artifactFeeds: AKL/akl_libs

- bash: |
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install setup
pip install -r requirements.txt
displayName: pip install
workingDirectory: $(workingDirectory)
displayName: 'Install application dependencies'
- task: RegExMatchReplace@2
displayName: 'Set addon version'
Expand All @@ -86,14 +90,24 @@ stages:
RegEx: 'version="\d+\.\d+\.\d+.*" provider'
ValueToReplace: 'version="$(addonVersion)" provider'

- bash: update_addon_news $(workingDirectory)/addon.xml $(workingDirectory)/changelog.md
- bash: |
source .venv/bin/activate
update_addon_news $(workingDirectory)/addon.xml $(workingDirectory)/changelog.md
displayName: 'Add changelog in addon.xml'
workingDirectory: '$(workingDirectory)'
- bash: 'python -m pytest --junitxml=$(build.artifactstagingdirectory)/$(addonName)_$(addonVersion)_testresults.xml'
# - script: |
# source .venv/bin/activate
# python -m flake8 .
# workingDirectory: '$(workingDirectory)'
# displayName: 'Run lint tests'

- bash: |
source .venv/bin/activate
python -m pytest --junitxml=$(build.artifactstagingdirectory)/$(addonName)_$(addonVersion)_testresults.xml
workingDirectory: '$(workingDirectory)'
displayName: 'Run tests'
displayName: 'Run unit tests'
- task: CopyFiles@2
displayName: 'Copy addon files for package'
inputs:
Expand All @@ -112,6 +126,12 @@ stages:
flattenFolders: false
OverWrite: true

- bash: |
source .venv/bin/activate
kodi-addon-checker --branch matrix $(build.artifactstagingdirectory)/$(addonName)/
workingDirectory: '$(workingDirectory)'
displayName: 'Run Kodi addon checker'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(build.artifactstagingdirectory)/$(addonName)'
Expand Down
10 changes: 10 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[flake8]
max-line-length = 140
exclude =
.git,
tests/*,
__pycache__,
.build,
.vscode,
.venv
ignore = W293
6 changes: 2 additions & 4 deletions addon.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
# Advanced Kodi Launcher main script file
#
Expand All @@ -18,6 +18,7 @@

# Advanced Emulator Launcher main script file.

# --- Python standard library ---
import sys
import logging

Expand All @@ -28,13 +29,10 @@
kodilogging.config()
logger = logging.getLogger(__name__)

# --- Python standard library ---
import sys

# -------------------------------------------------------------------------------------------------
# Entrypoint of the Frontend/UI application
# -------------------------------------------------------------------------------------------------

try:
views.run_plugin(sys.argv)
except Exception as ex:
Expand Down
4 changes: 2 additions & 2 deletions addon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.routing" version="0.2.3"/>
<import addon="script.module.akl" version="1.0.7"/>
<import addon="script.module.akl" version="1.0.9"/>
</requires>
<extension point="xbmc.python.pluginsource" library="addon.py">
<provides>executable game</provides>
Expand All @@ -15,7 +15,7 @@
<platform>android freebsd ios linux osx windows</platform>
<license>GNU General Public License version 2</license>
<email>[email protected]</email>
<forum>http://forum.kodi.tv/showthread.php?tid=366351</forum>
<forum>https://forum.kodi.tv/showthread.php?tid=366351</forum>
<website>https://github.com/chrisism/plugin.program.akl</website>
<source>https://github.com/chrisism/plugin.program.akl</source>
<assets>
Expand Down
12 changes: 6 additions & 6 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
## Current
- Added support for PEGI rating
- Fixed bug deleting collections
- Proper icon/thumb mapping for virtual collections

## Previous
- Virtual categories now render items from database
- Add and execute single instance ROMs or Games
- Added an overview option with installed plugins
- Fix adding tags to ROMs
- Minor bugfixes
- Updated dependency

## Bugfixes
- Fixed virtual collections (Favs, Most recent ..)
- Fixed scraping ROM assets only

## Previous: v1.0.0
- The initial release of the new AKL fork.
- Fixed scraping ROM assets only
Binary file modified media/fanart.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/theme/Browse_by_PEGI_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/theme/Browse_by_PEGI_poster.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ kodi-addon-checker==0.0.26
Kodistubs==19.0.3
routing==0.2.3
pytest==6.2.5
script.module.akl==1.0.7
requests==2.22.0
script.module.akl==1.0.9
requests==2.22.0
flake8==5.0.4
20 changes: 19 additions & 1 deletion resources/lib/commands/rom_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def cmd_rom_metadata(args):
options['ROM_EDIT_METADATA_NPLAYERS'] = "Edit NPlayers: '{}'".format(rom.get_number_of_players())
options['ROM_EDIT_METADATA_NPLAYERS_ONL']= "Edit NPlayers online: '{}'".format(rom.get_number_of_players_online())
options['ROM_EDIT_METADATA_ESRB'] = "Edit ESRB rating: '{}'".format(rom.get_esrb_rating())
options['ROM_EDIT_METADATA_PEGI'] = "Edit PEGI rating: '{}'".format(rom.get_pegi_rating())
options['ROM_EDIT_METADATA_RATING'] = "Edit Rating: '{}'".format(rating)
options['ROM_EDIT_METADATA_PLOT'] = "Edit Plot: '{}'".format(plot_str)
options['ROM_EDIT_METADATA_TAGS'] = "Edit Tags"
Expand Down Expand Up @@ -215,7 +216,7 @@ def cmd_rom_metadata_title(args):
AppMediator.sync_cmd('ROM_EDIT_METADATA', args)

@AppMediator.register('ROM_EDIT_METADATA_ESRB')
def cmd_rom_metadata_platform(args):
def cmd_rom_metadata_esrb(args):
rom_id = args['rom_id'] if 'rom_id' in args else None
uow = UnitOfWork(globals.g_PATHS.DATABASE_FILE_PATH)
with uow:
Expand All @@ -230,6 +231,23 @@ def cmd_rom_metadata_platform(args):
AppMediator.async_cmd('RENDER_VCATEGORY_VIEW', {'vcategory_id': constants.VCATEGORY_ESRB_ID})

AppMediator.sync_cmd('ROM_EDIT_METADATA', args)

@AppMediator.register('ROM_EDIT_METADATA_PEGI')
def cmd_rom_metadata_pegi(args):
rom_id = args['rom_id'] if 'rom_id' in args else None
uow = UnitOfWork(globals.g_PATHS.DATABASE_FILE_PATH)
with uow:
repository = ROMsRepository(uow)
rom = repository.find_rom(rom_id)

if editors.edit_field_by_list(rom, 'PEGI rating', constants.PEGI_LIST,
rom.get_pegi_rating, rom.set_pegi_rating):
repository.update_rom(rom)
uow.commit()
AppMediator.async_cmd('RENDER_ROM_VIEWS', {'rom_id': rom.get_id()})
AppMediator.async_cmd('RENDER_VCATEGORY_VIEW', {'vcategory_id': constants.VCATEGORY_PEGI_ID})

AppMediator.sync_cmd('ROM_EDIT_METADATA', args)

@AppMediator.register('ROM_EDIT_METADATA_RELEASEYEAR')
def cmd_rom_metadata_releaseyear(args):
Expand Down
21 changes: 9 additions & 12 deletions resources/lib/commands/stats_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,25 @@
from __future__ import division

import logging
import collections
import typing

from akl import constants
from akl.utils import kodi, io
from akl.utils import kodi

from resources.lib.commands.mediator import AppMediator
from resources.lib import globals
from resources.lib.repositories import UnitOfWork, ROMCollectionRepository, ROMsRepository, ROMsJsonFileRepository
from resources.lib.domain import ROM, AssetInfo, g_assetFactory
from resources.lib.repositories import UnitOfWork, ROMsRepository

logger = logging.getLogger(__name__)


# -------------------------------------------------------------------------------------------------
# ROM stats
# -------------------------------------------------------------------------------------------------

@AppMediator.register('ROM_WAS_LAUNCHED')
def cmd_process_launching_of_rom(args):
logger.debug('ROM_WAS_LAUNCHED: cmd_process_launching_of_rom() Processing that a ROM was launched')
rom_id:str = args['rom_id'] if 'rom_id' in args else None
rom_id: str = args['rom_id'] if 'rom_id' in args else None
if rom_id is None:
logger.warning('cmd_process_launching_of_rom(): No rom id supplied.')
return
Expand All @@ -55,24 +53,23 @@ def cmd_process_launching_of_rom(args):
logger.debug('ROM_WAS_LAUNCHED: cmd_process_launching_of_rom() Processed stats for ROM {}'.format(rom.get_name()))
AppMediator.async_cmd('RENDER_VCOLLECTION_VIEW', {'vcollection_id': constants.VCOLLECTION_RECENT_ID})
AppMediator.async_cmd('RENDER_VCOLLECTION_VIEW', {'vcollection_id': constants.VCOLLECTION_MOST_PLAYED_ID})



@AppMediator.register('ADD_ROM_TO_FAVOURITES')
def cmd_add_rom_to_favourites(args):
rom_id:str = args['rom_id'][0] if 'rom_id' in args else None
rom_id: str = args['rom_id'] if 'rom_id' in args else None
if rom_id is None:
logger.warning('cmd_add_rom_to_favourites(): No rom id supplied.')
logger.warning('No rom id supplied.')
kodi.notify_warn("Invalid parameters supplied.")
return

uow = UnitOfWork(globals.g_PATHS.DATABASE_FILE_PATH)
with uow:
repository = ROMsRepository(uow)
rom = repository.find_rom(rom_id)

rom.add_to_favourites()
repository.update_rom(rom)
uow.commit()

logger.debug('ADD_ROM_TO_FAVOURITES: cmd_add_rom_to_favourites() Added ROM {} to favourites'.format(rom.get_name()))
logger.debug(f'Added ROM {rom.get_rom_identifier()} to favourites')
AppMediator.async_cmd('RENDER_VCOLLECTION_VIEW', {'vcollection_id': constants.VCOLLECTION_FAVOURITES_ID})

Loading

0 comments on commit abc2cbb

Please sign in to comment.