openmedia-arrange

command module
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 16 Imported by: 0

README

openmedia-arrange

main version GitHub stars

The console application to report and organize OpenMedia XML exports.

Disclaimer: Although we developed this package as an open-source, we use it only for our needs. Feel free to read the source code but don't expect nothing else.

Add a ⭐ on GitHub — it motivates us!

Description

This program organize the specific type of XML files exported from OpenMedia system by Annova used in Czech Radio. The files are periodically downloaded stored in dedicated folder. The goal of this program is to organize that files by the year and week. The program implements the practice mode so it can be used for reporting purposes.

Usage

Flags
-i string
    The input paths.
-o string
    The output path.
-r    Really make changes to file system.
-s    Print application settings and exit.
-v    Print application version and exit.
  • When the specified input folder is empty the program exits.
  • The program does not operate recursively on subfolders.
Output

The each line contains a message which is a valid JSON object.

Example
2023/04/13 10:18:23 [SUCCESS] {"index":28,"status":"failure","action":"move","file":{"date":"2023-04-12","week":"W15","path":{"original":"\\\\cro.cz\\srv\\annova\\export-avo","expected":"\\\\cro.cz\\srv\\annova\\export-avo\\Contacts\\2023\\W15"},"name":{"original":"CT_Ksandr__Karel_2_991007_20230412033523.xml","modified":"CT_Ksandr_Karel_2_991007_20230412033523.xml"}}}
Schema
{ 
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.com/product.schema.json",  
  "title": "index",
  "type": "number",
  "description": "Sequential index starting from one.",
  "title": "status",
  "description": "Status either 'success' or 'failure'.",
  "title": "action",
  "type": "string",
  "description": "Action required either 'none', 'move'.",
  "title": "file",
  "type": "string",
  "description": "The file information",
  "type": "object",
  "properties": {
    "date": {
        "type": "string",
        "description": "Rundown/contact file's expected broadcast date.", 
    },
    "week": {
        "type": "number",
        "description": "Rundown/contact file's detected week number (`1..52/53`)."
    },
    "path": {
      "original": "Rundown/contact file original path.",
      "expected": "Rundown/contact file expected path."
    },
    "name": {
        "original": "Rundown/contact file original name.",
        "modofied": "Rundown/contact file modified name."
    }
  },
  "required": ["index", "status", "action", "file"]
}

Installation

You can obtain the program by downloading the binary executable from release page or you can build it by yourself from the source.

  1. Clone the repository.

    git clone https://github.com/czech-radio/openmedia-arrange.git
    
  2. Change the directory.

    cd openmedia-arrange
    
  3. Update project dependencies.

    go mod tidy
    
  4. Build the executable file.

    Unix

    . build.sh
    

    Windows

     .\build.ps1
    

Contribution

Propose new feature, enhance existing feature or fix a bug.

You can use Makefile for development.

Testing

Run program manually on test files. This should be automated in a near future!

Release
  • Create new branch named relaes/vX.Y.Z

  • Build, lint, and test the project

  • Change the version in README.md

  • Craete update CHANGELOG

  • Create Git tag with name vX.Y.Z

  • Push commit and tags to remote

  • Open pull-request and squash merge

  • Sometimes you need to include bug fixes from main branch.

  • All feature branches must not be merged to main while releasing.

Documentation

Overview

Package contains domain types and business logic.

Package main contains the command line interface and execution logic.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL