Bug 403029

Summary: Import online quote sources from kmymoney
Product: [Frameworks and Libraries] libalkimia Reporter: Ralf Habacker <ralf.habacker>
Component: GeneralAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: REPORTED ---    
Severity: wishlist    
Priority: NOR    
Version: master   
Target Milestone: 8.2   
Platform: Other   
OS: All   
Latest Commit: Version Fixed In:

Description Ralf Habacker 2019-01-09 11:36:25 UTC
As part of the migration of the online quote support from KMyMoney to alkimia, the standard online sources available from kmymoney (and skrooge) must be imported into alkimia and then installed with alkimia.

It is planned to store the online sources, which are currently contained in the KMymoney configuration file, in individual files so that they can be installed more easily (suggested by Thomas). These files can then be adapted using the "Online Quotes Editor".
To make the online quotes independent from the provision of a new alkimia version, the imported sources can then be uploaded to store.kde.org and used instead of the installed alkimia sources.

Required activities:
1. extract the corresponding attributes from the categories (Online Quote Source <name>) of the kmymoneyrc file
2. create the corresponding files in the alkimia source directory (e.g.: data/quotes)
3. extending the build system to install the sources
4. extension of AlkOnlineQuotesProfile and AlkOnlineQuoteSource to find and load these files
5. specify locations for read only and modified online quote source files
6. Add support to detect and updated new files

Open points:
1. definition of the file format used
    The following variants are available:
    1. use the format used by kmymoney4 [1]
      (https://cgit.kde.org/alkimia.git/tree/src/alkonlinequotesource.cpp#n62)
    2. use the old Skrooge .txt file format 
      (https://cgit.kde.org/alkimia.git/tree/src/alkonlinequotesource.cpp#n119)
    3. use the Skrooge desktop file format 
       (https://cgit.kde.org/skrooge.git/tree/skgbankmodeler/sources/org.kde.skrooge-source-skrooge.desktop)
       (suggested by Stephane Mankowski, skrooge developer)
    At least the choosed format need to have a kind of "parser type" or 
    "data format type" attribute to be able to specify which parser to use. [2] [3]
2. procedure for performing the import (by hand, command line tool, online quote editor)

Notes:
[1] KMymoney5 uses a different approach by specifying different URLs for html and csv. Following this style would require adding URLs for each type, which does not make sense.  

[2] Currently only HTML is supported, CSV support would have to be imported from kmymoney5, json and xml require a new parser implementation.

[3] In the first step it makes most sense to use the already available file formats and later, when the Online Quote support of alkimia is established, to specify your own format, if required.
Comment 1 Ralf Habacker 2019-01-11 08:47:21 UTC
> [2] Currently only HTML is supported, CSV support would have to be imported
> from kmymoney5, json and xml require a new parser implementation.
Parsing online quotes in Json format is already supported and can be checked with the Alkimia online quote  for Alphavantage.co (https://store.kde.org/p/1284585/)
Comment 2 Ralf Habacker 2019-04-09 06:18:24 UTC
(In reply to Ralf Habacker from comment #1)
> > [2] Currently only HTML is supported, CSV support would have to be imported
> > from kmymoney5, json and xml require a new parser implementation.
> Parsing online quotes in Json format is already supported and can be checked
> with the Alkimia online quote  for Alphavantage.co
> (https://store.kde.org/p/1284585/)

This quote has been moved to https://store.kde.org/p/1291552/
Comment 3 Ralf Habacker 2019-04-09 08:18:13 UTC
(In reply to Ralf Habacker from comment #0)
> Required activities:
> 4. extension of AlkOnlineQuotesProfile and AlkOnlineQuoteSource to find and
> load these files
> 5. specify locations for read only and modified online quote source files
> 6. Add support to detect and updated new files

It turned out that these files need to be installed into a directory independently from the directory where the GHNS files are downloaded to avoid file name clashing. 

Based on the system data pathes: 

kde4-config --path data
/home/xxx/.kde4/share/apps/:/usr/share/kde4/apps

kf5-config --path data
/home/xxx/.local/share/:/usr/share/

with recent implementation the following pathes would be used:

read only location (installed by build system)

  kde4:/usr/share/kde4/apps/alkimia/quotes
  kf5:/usr/share/alkimia/quotes


location after modifying by the user (installed by online quote editor or kmymoney online quote settings page)

  kde4:/home/xxx/.kde4/share/apps/alkimia/quotes
  kf5:/home/xxx/.local/share/alkimia/quotes


The GHNS files are installed by the newstuff library always into the writable location, which is defined by the related knsrc config file and points currently to:

  kde4:/home/xxx/.kde4/share/apps/alkimia/quotes
  kf5:/home/xxx/.local/share/alkimia/quotes
Comment 4 Ralf Habacker 2024-01-03 22:09:33 UTC
In git master the commit https://invent.kde.org/office/alkimia/-/commit/f88014cffc91b8837cfba8333957fcadbe43bb9a has been added which uses a shared config file as different approach.