semvec/pypi-packages huggingface dataset:
frame-generator 1.0
A module to easily read frames from from a vide and display useful video information.
License: MIT
Keywords: vide,frame,frame-reader

# Description
frame_generator is a simple python package based on opencv to easily grab
frames from a video files.
#Features
- Creates a generator which iteratively yields the frames from a video file.
- Can skip pre-defined number of frames
- Can choose color mode of the yielded frame
- Allow you to display useful information about a video file.
#Install
```
pip install frame_generator
```

#Usage
###### Reading frames from a video file
Note: the following script will show every 10th frame from the video.
```python
from frame_generator import FrameGenerator

video_file = "PATH/TO/A/VIDEO/FILE"

fg = FrameGenerator(video_source=video_file, 
                    show_video_info=True, 
                    color_mode="BGR", 
                    every_nth_frame=10)
for frame in fg:
    do_something_with_frame(frame)
```
Parameters:

    video_source: str
        path to the frame_generator file you want to read.
    
    show_video_info: bool
        if true then frame_generator info is printed to the console
    
    every_nth_frame: int
        every nth frame will be yielded by the generator. 
        1 means that every single frame will be yielded.
    
    color_mode: str, Optional
        can be 'RGB', 'BGR' or 'Grayscale'
        
###### Getting and displaying video info
```python
from frame_generator.video_info import get_video_info, prettify_video_info

video_file = "PATH/TO/A/VIDEO/FILE"
video_file, frame_count, fps, length, height, width = get_video_info(
    video_file
)
print(prettify_video_info(video_file, 
                          frame_count, 
                          fps, 
                          length, 
                          height, 
                          width))
```
zubr-temp 0.2.4
Zubr exchange SDK
License: MIT
Requires Python: >=3.6

# Zubr exchange SDK
## Simple example
```python
import logging
from pprint import pprint

from zubr import ZubrSDK, OrderType, TimeInForce

zubr_sdk = ZubrSDK(
    api_key='YOUR-API-KEY-HERE',
    api_secret='YOUR-API-SECRET-HERE',
)

logging.basicConfig(level=logging.INFO)

context = {
    'order_placed': False,
    'sell_price': '0',
}


def sell_and_cancel(message):
    print(f'order placed: {message}')
    order_id = message['result']['value']

    # Cancel order
    zubr_sdk.cancel_order(
        order_id=order_id,
        callback=lambda x: (
            print(f'Order cancelled: {x}')
        ),
    )


def sell_and_replace(message):
    print(f'order placed: {message}')
    order_id = message['result']['value']

    # Replace order
    zubr_sdk.replace_order(
        order_id=order_id,
        price=context['sell_price'],
        size=2,
        callback=lambda x: (
            print(f'Order replaced: {x}')
        ),
    )


# Fetch orderbook
@zubr_sdk.subscribe_orderbook
def on_orderbook(message):
    print('orderbook:')
    pprint(message)

    if context['order_placed']:
        return

    instrument_id, orders = list(message['value'].items())[0]
    sell_price = max(x['price'] for x in orders['asks'])
    context['sell_price'] = sell_price

    # Place and replace
    zubr_sdk.sell(
        instrument_id=instrument_id,
        price=sell_price,
        size=1,
        order_type=OrderType.LIMIT,
        time_in_force=TimeInForce.GTC,
        callback=sell_and_replace,
    )

    # Place and cancel
    zubr_sdk.sell(
        instrument_id=instrument_id,
        price=sell_price,
        size=1,
        order_type=OrderType.LIMIT,
        time_in_force=TimeInForce.GTC,
        callback=sell_and_cancel,
    )

    context['order_placed'] = True


# Fetch last trades
@zubr_sdk.subscribe_last_trades
def on_last_trades(message):
    print('last trades:')
    pprint(message)


zubr_sdk.run_forever()
```